On 20 July 2010 20:51, Johann <[email protected]> wrote: > Hi all, > I want to create charts in my website. I want to fill them with > variables. So in my controller, I put the variables I want to use : > > class ChartsController < ApplicationController > def show_one_publisher_seven_days > �...@title = 'foo' > end > end > > 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}" Check the html generated in the browser to check it is what you expect. By the way, it is generally considered bad form to put javascript like this in the view. Ideally all javascript should be in separate files. Colin -- 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.

