File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
actionpack/lib/action_controller/metal Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,23 @@ module Flash
11
11
end
12
12
13
13
module ClassMethods
14
+ # Creates new flash types. You can pass as many types as you want to create
15
+ # flash types other than the default <tt>alert</tt> and <tt>notice</tt> in
16
+ # your controllers and views. For instance:
17
+ #
18
+ # # in application_controller.rb
19
+ # class ApplicationController < ActionController::Base
20
+ # add_flash_types :warning
21
+ # end
22
+ #
23
+ # # in your controller
24
+ # redirect_to user_path(@user), warning: "Incomplete profile"
25
+ #
26
+ # # in your view
27
+ # <%= warning %>
28
+ #
29
+ # This method will automatically define a new method for each of the given
30
+ # names, and it will be available in your views.
14
31
def add_flash_types ( *types )
15
32
types . each do |type |
16
33
next if _flash_types . include? ( type )
You can’t perform that action at this time.
0 commit comments