Permalink
Browse files

added convenience methods #notice and #alert to flash.now

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent cdf7001 commit e807476d31fd15fbf8808d739b0afada4faeece9 Martin committed with josevalim Apr 15, 2010
Showing with 10 additions and 0 deletions.
  1. +10 −0 actionpack/lib/action_dispatch/middleware/flash.rb
View
10 actionpack/lib/action_dispatch/middleware/flash.rb
@@ -49,6 +49,16 @@ def []=(k, v)
def [](k)
@flash[k]
end
+
+ # Convenience accessor for flash.now[:alert]=
+ def alert=(message)
+ self[:alert] = message
+ end
+
+ # Convenience accessor for flash.now[:notice]=
+ def notice=(message)
+ self[:notice] = message
+ end
end
class FlashHash < Hash

0 comments on commit e807476

Please sign in to comment.