lib/roda/plugins/flash.rb in roda-2.27.0 vs lib/roda/plugins/flash.rb in roda-2.28.0
- old
+ new
@@ -36,10 +36,11 @@
# flash['a'] # = >'b'
# end
module Flash
# The internal session key used to store the flash.
KEY = :_flash
+ RodaPlugins.deprecate_constant(self, :KEY)
# Simple flash hash, where assiging to the hash updates the flash
# used in the following request.
class FlashHash < DelegateClass(Hash)
# The flash hash for the next request. This
@@ -92,19 +93,19 @@
module InstanceMethods
# Access the flash hash for the current request, loading
# it from the session if it is not already loaded.
def flash
- @_flash ||= FlashHash.new(session[KEY])
+ @_flash ||= FlashHash.new(session[:_flash])
end
# If the routing doesn't raise an error, rotate the flash
# hash in the session so the next request has access to it.
def call
res = super
if f = @_flash
- session[KEY] = f.next
+ session[:_flash] = f.next
end
res
end
end