Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeoutable Writing to Flash #2417

Closed
timeemit opened this issue May 13, 2013 · 1 comment
Closed

Timeoutable Writing to Flash #2417

timeemit opened this issue May 13, 2013 · 1 comment

Comments

@timeemit
Copy link

When an account is timed out, the flash that comes out of the warden callback is

#<ActionDispatch::Flash::FlashHash:0x007ff91c8840d8 @used=#<Set: {:alert, :timedout}>, @closed=false, @flashes={:alert=>"Your session expired, please sign in again to continue.", :timedout=>true}, @now=nil>

Is the :timedout key necessary?

Ryan Bate's railscast has a popular code snippet for iterating through the flash hash:

<% flash.each do |key, msg| %>
  <%= content_tag :div, msg, :id => key %>
<% end %>

This, in combination with the timeoutable module, renders two messages upon timing out the session instead of just the one I18n message. This can be worked around with a simple unless key == :timedout clause but should Devise really be writing to the flash in this manner?

@josevalim
Copy link
Contributor

Yes, it is "required". Please see previous discussion.

We could get away with storing it in session and cleaning it up afterwards but we would be replicating Rails' flash logic and lose other aspects like laziness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants