Method: ActionDispatch::Flash::FlashHash#discard
- Defined in:
- actionpack/lib/action_dispatch/middleware/flash.rb
#discard(k = nil) ⇒ Object
Marks the entire flash or a single flash entry to be discarded by the end of the current action:
flash.discard # discard the entire flash at the end of the current action
flash.discard(:warning) # discard only the "warning" entry at the end of the current action
Use this method when you want to display the message in the current action but not in the next one. See also #delete.
264 265 266 267 268 |
# File 'actionpack/lib/action_dispatch/middleware/flash.rb', line 264 def discard(k = nil) k = k.to_s if k @discard.merge Array(k || keys) k ? self[k] : self end |