diff options
author | Florent Piteau <florent.piteau@sylogix.net> | 2011-04-20 02:10:29 +0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-04-20 04:32:26 +0800 |
commit | 89ed9fbd1917e431e489dc856042d996d0f088c5 (patch) | |
tree | 004d79e332ab71baab5f8aadbac51b4d23199c4d /actionpack/lib | |
parent | 22fcef90b185199563719fc511346bf4c2f5bbff (diff) | |
download | rails-89ed9fbd1917e431e489dc856042d996d0f088c5.tar.gz rails-89ed9fbd1917e431e489dc856042d996d0f088c5.tar.bz2 rails-89ed9fbd1917e431e489dc856042d996d0f088c5.zip |
Don't reuse a closed flash when using now
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/flash.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/flash.rb b/actionpack/lib/action_dispatch/middleware/flash.rb index 735c72d34a..c7f7d4d4f0 100644 --- a/actionpack/lib/action_dispatch/middleware/flash.rb +++ b/actionpack/lib/action_dispatch/middleware/flash.rb @@ -70,6 +70,10 @@ module ActionDispatch def close!(new_flash) @flash = new_flash end + + def closed? + @flash.closed? + end end class FlashHash @@ -146,7 +150,7 @@ module ActionDispatch # # Entries set via <tt>now</tt> are accessed the same way as standard entries: <tt>flash['my-key']</tt>. def now - @now ||= FlashNow.new(self) + @now = (!@now || @now.closed?) ? FlashNow.new(self) : @now end attr_reader :closed |