Module: ActionDispatch::Flash::RequestMethods
- Included in:
- Request
- Defined in:
- lib/action_dispatch/middleware/flash.rb
Instance Method Summary collapse
-
#commit_flash ⇒ Object
:nodoc:.
-
#flash ⇒ Object
Access the contents of the flash.
- #flash=(flash) ⇒ Object
-
#flash_hash ⇒ Object
:nodoc:.
-
#reset_session ⇒ Object
:nodoc:.
Instance Method Details
#commit_flash ⇒ Object
:nodoc:
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/action_dispatch/middleware/flash.rb', line 71 def commit_flash # :nodoc: return unless session.enabled? if flash_hash && (flash_hash.present? || session.key?("flash")) session["flash"] = flash_hash.to_session_value self.flash = flash_hash.dup end if session.loaded? && session.key?("flash") && session["flash"].nil? session.delete("flash") end end |
#flash ⇒ Object
Access the contents of the flash. Returns a ActionDispatch::Flash::FlashHash.
See ActionDispatch::Flash for example usage.
57 58 59 60 61 |
# File 'lib/action_dispatch/middleware/flash.rb', line 57 def flash flash = flash_hash return flash if flash self.flash = Flash::FlashHash.from_session_value(session["flash"]) end |
#flash=(flash) ⇒ Object
63 64 65 |
# File 'lib/action_dispatch/middleware/flash.rb', line 63 def flash=(flash) set_header Flash::KEY, flash end |
#flash_hash ⇒ Object
:nodoc:
67 68 69 |
# File 'lib/action_dispatch/middleware/flash.rb', line 67 def flash_hash # :nodoc: get_header Flash::KEY end |
#reset_session ⇒ Object
:nodoc:
84 85 86 87 |
# File 'lib/action_dispatch/middleware/flash.rb', line 84 def reset_session # :nodoc: super self.flash = nil end |