I’ve seen the other posts, but can’t seem to figure out why this isn’t working for me
In my controller I set
@referrer=referrer.name
in my view i have
<%= render 'js', :referrer => @referrer >
then in my partial i put
var type =' <%= referrer >';
I get a response ‘undefined local variable or method ‘referrer’ and it points to the _js file.
from what I can see, this is exactly how it is supposed to be written, what am I doing wrong?
Your variables to use in the partial need to be passed via the :locals hash.
Reference: http://api.rubyonrails.org/classes/ActionView/Partials.html
EDIT
The following works perfectly for me:
Controller:
index.html.erb
_account.html.erb