Your code (the one you have shown in the first line) should work. There is no error. I have even tested it myself and it works for me.
The usual reasons for such errors are:
- misspelled variable name
- calling the partial also from some other place, where you do not pass a :local.
The fact that your model does not have the attribute "img_style" is not important.
I can see that in your infos/index.html.erb
you have two places where you call render :partial => 'info', :object => ...
and you do not have :locals here. Just the line numbers do not match with the stacktrace you have posted earlier, so it's hard to say which call causes the problem.
I guess both calls to the render
method need corrections.
In the first one, be specific, and call render :partial => "info"
instead of render "info"
. This may be a bug in Rails, but for some strange reason, :locals seem to not be passed to the view in this case.
In the second call to render
just add the :locals.