开发者

Rails: Set a temporary variable?

开发者 https://www.devze.com 2023-01-29 08:51 出处:网络
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

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 %>
0

精彩评论

暂无评论...
验证码 换一张
取 消