0

I have controller say Home_controller providing @max = 10 @min=4. And then I later used these two values in my Home.js.erb file rests in /asset/javascript.

values= [<%=@max%>,<%=@min%>]

But it doesn't seem to be working, because when I look at the resultant javascript file from firebug, wherever I have @max or @min, they just show up as blank.

What's going on here? I am new to rails asset pipeline, so I may have some misunderstanding here.

1 Answer 1

1

Rails passes the instance variables from Controller to View. So, you want to place the home.js.erb in the views folder and not in the assets.

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.