On Thu, Feb 11, 2010 at 12:58 PM, Marnen Laibow-Koser
<[email protected]> wrote:
> Why do you prefer RJS to writing JavaScript?

RJS is a template rendering system that also happens to execute JS.  I
do not prefer one over the other, it's apples and oranges.

Controller action:

def get_user
  if request.xhr?
    @user = User.find( params[:id] )
  end
end

get_user.rjs:

if @user
  page.replace_html 'user_tab', :partial => 'user/user_form'
  page << "$j( '#user_tab' ).fadeIn('slow');"
end

>>> How do you keep the generated JavaScript out of your HTML?
>>
>> Partials.
>>
> Wouldn't that still put the JavaScript into your HTML files?

Yup.


-- 
Greg Donald
destiney.com | gregdonald.com

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to