سؤال

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 Google 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 %>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top