Tuesday, October 12, 2010

[Rails] Re: Re: RJS vs Javascript Template in Rails 3?

Rob Lacey wrote in post #949724:
> On 13 October 2010 03:15, Marnen Laibow-Koser <lists@ruby-forum.com>
> wrote:
>>>
>>> #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?

Not at all. You can have dynamic content with static JS files (search
the list archives for more info -- I go through this discussion every
couple of weeks :) ). My usual method is to have the JS read a hidden
element that Rails puts in the DOM.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org

--
Posted via http://www.ruby-forum.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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate