instance method
use
Ruby on Rails 3.0.20
Since v3.0.20 Last seen in v3.2.22.5 PrivateSignature
use(key = nil, used = true)
Used internally by the keep and discard methods
use() # marks the entire flash as used use('msg') # marks the "msg" entry as used use(nil, false) # marks the entire flash as unused (keeps it around for one more action) use('msg', false) # marks the "msg" entry as unused (keeps it around for one more action)
Returns the single value for the key you asked to be marked (un)used or the FlashHash itself if no key is passed.
Parameters
-
keyopt = nil -
usedopt = true
Source
# File actionpack/lib/action_dispatch/middleware/flash.rb, line 167
def use(key = nil, used = true)
Array(key || keys).each { |k| used ? @used << k : @used.delete(k) }
return key ? self[key] : self
end
Defined in actionpack/lib/action_dispatch/middleware/flash.rb line 167
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Flash::FlashHash