diff --git a/actionpack/lib/action_dispatch/middleware/flash.rb b/actionpack/lib/action_dispatch/middleware/flash.rb
index 7e00510fa8..7e56feb90a 100644
--- a/actionpack/lib/action_dispatch/middleware/flash.rb
+++ b/actionpack/lib/action_dispatch/middleware/flash.rb
@@ -59,22 +59,12 @@ module ActionDispatch
@flash[k]
end
- # Convenience accessor for flash.now[:alert]=
- #
- # Example:
- #
- # flash.alert = "Error: no cheezburger"
- # # Equivlant to flash[:alert] = "No cheezburger"
+ # Convenience accessor for flash.now[:alert]=.
def alert=(message)
self[:alert] = message
end
- # Convenience accessor for flash.now[:notice]=
- #
- # Example:
- #
- # flash.notice = "Bukkit stolen"
- # # Equivlant to flash[:notice] = "Bukkit stolen"
+ # Convenience accessor for flash.now[:notice]=.
def notice=(message)
self[:notice] = message
end
@@ -92,7 +82,7 @@ module ActionDispatch
else
new
end
-
+
flash.tap(&:sweep)
end
@@ -179,6 +169,14 @@ module ActionDispatch
# vanish when the current action is done.
#
# Entries set via now are accessed the same way as standard entries: flash['my-key'].
+ #
+ # Also, brings two convenience accessors:
+ #
+ # flash.now.alert = "Beware now!"
+ # # Equivalent to flash.now[:alert] = "Beware now!"
+ #
+ # flash.now.notice = "Good luck now!"
+ # # Equivalent to flash.now[:notice] = "Good luck now!"
def now
@now ||= FlashNow.new(self)
end
@@ -209,22 +207,22 @@ module ActionDispatch
@discard.replace @flashes.keys
end
- # Convenience accessor for flash[:alert]
+ # Convenience accessor for flash[:alert].
def alert
self[:alert]
end
- # Convenience accessor for flash[:alert]=
+ # Convenience accessor for flash[:alert]=.
def alert=(message)
self[:alert] = message
end
- # Convenience accessor for flash[:notice]
+ # Convenience accessor for flash[:notice].
def notice
self[:notice]
end
- # Convenience accessor for flash[:notice]=
+ # Convenience accessor for flash[:notice]=.
def notice=(message)
self[:notice] = message
end