I have
render @users
in my users view. It renders the @users in a nicely formatted way that I specified in _user.html.erb. I am now trying to do this:
render @attendees
which is a hash of users. I am trying to render this in my events view (a different view). The problem is that I want to render @attendees differently than @users but it always seems to use the _user.html.erb to render. How do I specify a different rendering?
As far as I’m aware, you can’t use the convenience of
render @attendeesto render a different partial than_usersince@attendeesare actuallyUserobjects. Rails uses the class to figure out what partial to render when using this condensed format.What you can do is
render :partial => 'users/attendees', :collection => @attendees, assuming you have a partialusers/_attendees.html.erb. If you don’t want to throw that around everywhere, wrap it in a helper.