Method: ActionDispatch::Flash::FlashHash#keep
- Defined in:
- actionpack/lib/action_dispatch/middleware/flash.rb
#keep(k = nil) ⇒ Object
Keeps either the entire current flash or a specific flash entry available for the next action:
flash.keep # keeps the entire flash
flash.keep(:notice) # keeps only the "notice" entry, the rest of the flash is discarded
250 251 252 253 254 |
# File 'actionpack/lib/action_dispatch/middleware/flash.rb', line 250 def keep(k = nil) k = k.to_s if k @discard.subtract Array(k || keys) k ? self[k] : self end |