1

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!

1
  • Maybe some code examples would help, I think what you're trying to do is Display.initialize(@category.to_json) Commented Jan 16, 2013 at 1:33

1 Answer 1

2

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

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

= javascript_include_tag "your_javascripts.js"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.