On 13 October 2010 03:15, Marnen Laibow-Koser <[email protected]> wrote:
> Samnang wrote in post #949445:
>> Hi all,
>>
>> I start looking in unobtrusive javascript functionality in Rails 3. I
>> couldn't make any different when to use RJS vs pure Javascript
>> template.
>>
>> For example:
>> #RJS:
>> page.replace_html, 'some_div', :partial => 'some_partial'
>>
>> #JS
>> $("some_div").update("<%= escape_javascript(render('some_partial'))
>> %>");
>
> Well, you should never ever be writing ERb in your JavaScript like that.
> JS files should IMHO always be static.


I've been looking at making a very JS heavy interface of late and it
actually requires replacing sections of the page with dynamic content.
Your take on it suggests that you could only ever return a static js
script, and therefore have no dynamic content. Is that right?

>
> I lean more toward writing my JavaScript directly, at least with Rails
> 2.  But RJS might be nice for calling certain Ajax actions.

The above examples merely do the same job with a cleaner syntax?

Just trying to take a look at best practices and gauge what I would
consider to be most appropriate.

RobL

-- 
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