I've been looking at the Rails-style-guide and it says that I should not share more than two instance variables from my controller with the view. I've been sharing a lot more than two instance variables with my view because
- I need to create new instances for partials, and
- I don't want long chained method calls in my views.
For example, I have a Group show view, which passes in @group, @users (which is all the users in the group), @notifications (the notifications for the user that are available everywhere in a dropdown), @activities, @messages (for the message board), and @message (the new message that can be generated.
That way my view looks like this:
<% @activities.each do |activity| %>
Should I instead just pass @group (eager loading it's users, messages, etc) and have calls in my view that look like this?:
<% @group.activities.future_activites.each do |activity| %> ...
Thanks.