aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2013-01-03 20:28:17 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2013-01-03 20:28:33 -0500
commit654f0d6a1520fc6a0a0396e78255a9ec50594e44 (patch)
treee9e47dce351a27e6e2241cc48df1efdc04b98631 /actionpack/lib/action_dispatch
parentdc14b893e5904acb37ac327478f3880f33094b7a (diff)
downloadrails-654f0d6a1520fc6a0a0396e78255a9ec50594e44.tar.gz
rails-654f0d6a1520fc6a0a0396e78255a9ec50594e44.tar.bz2
rails-654f0d6a1520fc6a0a0396e78255a9ec50594e44.zip
extract alert= and notice= examples to FlashHash#now [ci skip]
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/middleware/flash.rb32
1 files changed, 15 insertions, 17 deletions
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 <tt>flash.now[:alert]=</tt>.
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 <tt>flash.now[:notice]=</tt>.
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 <tt>now</tt> are accessed the same way as standard entries: <tt>flash['my-key']</tt>.
+ #
+ # 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 <tt>flash[:alert]</tt>.
def alert
self[:alert]
end
- # Convenience accessor for flash[:alert]=
+ # Convenience accessor for <tt>flash[:alert]=</tt>.
def alert=(message)
self[:alert] = message
end
- # Convenience accessor for flash[:notice]
+ # Convenience accessor for <tt>flash[:notice]</tt>.
def notice
self[:notice]
end
- # Convenience accessor for flash[:notice]=
+ # Convenience accessor for <tt>flash[:notice]=</tt>.
def notice=(message)
self[:notice] = message
end