instance method
keep
Ruby on Rails 7.2.3
Since v3.0.20Signature
keep(k = nil)
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
Parameters
-
kopt = nil
Source
# 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
Defined in actionpack/lib/action_dispatch/middleware/flash.rb line 250
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Flash::FlashHash