Unresolved reference in view when render action with locals

Answered

action in controller:

def index
render :index, locals: { my_var: 'show me`}
end

In view:

<p><%= my_var %></p>

I get a warning `Cannot find 'my_var'`. It is ok when instead of locals I use an instance variable

@my_var

It should not show this warning when the variable is provided via locals to the view.

3 comments
Comment actions Permalink

Hello,

we have a related issue on our tracker: https://youtrack.jetbrains.com/issue/RUBY-16193

In case it's similar to yours could you please add your vote there.

0
Comment actions Permalink

Hi Olga, 

Yes, it is similar but still, it does not give me a solution to the problem :D.

0
Comment actions Permalink

Unfortunately that's a feature that isn't supported yet so your vote is also important.

0

Please sign in to leave a comment.