Sarah A
Sarah A

Reputation: 1233

haml and javascript

i have a show.html.haml file that calls a display.js in my controller I have a variable @category

how would I use @category in my display.js file that's being used by view?

Thank you!

Upvotes: 1

Views: 247

Answers (1)

Sarah A
Sarah A

Reputation: 1233

Well I guess I just needed to take a short break; here:

= javascript_tag do
    var category = '#{@category}'

= javascript_include_tag "your_javascripts.js"

Upvotes: 2

Related Questions