Rails: Pass association object to the View
- by Fedyashev Nikita
Model Item belongs_to User.
In my controller I have code like this:
@items = Item.find(:all)
I need to have a corresponding User models for each item in my View templates.
it works in controller(but not in View template):
@items.each { |item| item.user }
But manual looping just to build associations for View template kinda smells.
How can I do this not in a creepy way?