instance method
discard
Ruby on Rails edge
Since v3.0.20Signature
discard(k = nil)
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.
Parameters
-
kopt = nil
Source
# File actionpack/lib/action_dispatch/middleware/flash.rb, line 261
def discard(k = nil)
k = stringify_key(k) if k
@discard.merge Array(k || keys)
k ? self[k] : self
end
Defined in actionpack/lib/action_dispatch/middleware/flash.rb line 261
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Flash::FlashHash