Reputation: 680
I've just updated to Rails 2.3.11. In an earlier version I could write the following
render :file=>'console/users/show.html.erb', :locals => {:@user => @users.first}
which no longer works, instead I need to write
render :file=>'console/users/show.html.erb', :locals => {:user => @users.first}
which means to access the user in the file I would use 'user' but in the file I would like to use the instance variable @user as this same show file is called from the controller and passes @user
Any tips?
Thanks
Upvotes: 0
Views: 3274
Reputation: 107728
Set @user
before calling render
:
@user = @users.first
render :file=>'console/users/show.html.erb'
The :locals
option should only be used if you are passing local variables through.
Upvotes: 3