Rails: Set a temporary variable?
I need to set a temporary variable (actually more of a "true" or "false") for a view.
The use case is that when a user is created, they are redirected to a dashboard page. For Googl开发者_Go百科e AdWords conversion tracking, there is a bit of code that needs to be displayed in the view, but it only should be displayed after the create
method has been run.
So I'm guessing the way to solve that is to set some temp variable (@show_conversion
or something) and set it for one view (similar to a flash message).
So, how do I do that?
<% unless @user.new_record? %>
<!-- do stuff in here -->
<% end %>
精彩评论