ruby on rails - Undefined method `each' for :users:Symbol thrown when using variables passed by render function -
It seems that more and more people are suggesting that in order to actually use the example variable in the controller There is a bad idea. That you should only send the variables to the render in the scene.
But when I do this for example:
DIF index user = user All render 'index', user: user end
then I am unable to use the : users
symbol in index view and for example, I repeat it . It throws an error: Undefined method
for each: User: Symbol 'for me.
Is it also a good idea to try to do this? I thought I would try it and see how it would work. But still I can not get it to work ...
user
Your view will have a variable, not a symbol
To iterate it, you should replace users.each
instead of : users.each
Have to call.
Comments
Post a Comment