1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

remove usage of @env

try to remove dependencies on `@env` so we can have more flexible
internals
This commit is contained in:
Aaron Patterson 2015-08-23 16:15:47 -07:00
parent 861146fdae
commit f038ed2d2a

View file

@ -6,15 +6,17 @@ module ActionDispatch
# read a notice you put there or <tt>flash["notice"] = "hello"</tt> # read a notice you put there or <tt>flash["notice"] = "hello"</tt>
# to put a new one. # to put a new one.
def flash def flash
@env[Flash::KEY] ||= Flash::FlashHash.from_session_value(session["flash"]) flash = flash_hash
return flash if flash
self.flash = Flash::FlashHash.from_session_value(session["flash"])
end end
def flash=(flash) def flash=(flash)
@env[Flash::KEY] = flash set_header Flash::KEY, flash
end end
def flash_hash # :nodoc: def flash_hash # :nodoc:
@env[Flash::KEY] get_header Flash::KEY
end end
end end