instance method use

Ruby on Rails 3.2.22.5

Since v3.0.20 Last seen in v3.2.22.5

Available in: v3.0.20 v3.1.12 v3.2.22.5

Signature

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

key opt = nil
used opt = true
Source
# File actionpack/lib/action_dispatch/middleware/flash.rb, line 227
        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 227 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionDispatch::Flash::FlashHash

Type at least 2 characters to search.

↑↓ navigate · open · esc close