Colin Law wrote:
> On 20 July 2010 21:10, Colin Law <[email protected]> wrote:
>>>
>>> And in my view (show_one_publisher_seven_days.haml), I want to assign
>>> my javascript variable with the variable I created in my controller.
>>>
>>> %script{:type => "text/javascript"}
>>>
>>> � � � �var title_text = <% @title %> � � � <<<===============
>>
>> It is haml not erb. Try
>> = "var title_text = #...@title}"
> 
> Oops, quickly returning to add to this after seeing Dave's response
> = "var title_text = '#...@title}'"

That should be
== var title_text = '#...@title}'
(two equals signs at the beginning and no outer quotes)

But this is a terrible idea.  What you want to do instead is put the 
value in a hidden div, then have your JS look at that div.  You should 
never have to generate JS dynamically from Ruby.

> 
> Colin

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
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 [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