module ActionController::Flash::ClassMethods

def action_methods # :nodoc:

:nodoc:
def action_methods # :nodoc:
  @action_methods ||= super - _flash_types.map(&:to_s).to_set
end

def add_flash_types(*types)

names, and it will be available in your views.
This method will automatically define a new method for each of the given

<%= warning %>
# in your view

redirect_to user_path(@user), warning: "Incomplete profile"
# in your controller

end
add_flash_types :warning
class ApplicationController < ActionController::Base
# in application_controller.rb

your controllers and views. For instance:
flash types other than the default alert and notice in
Creates new flash types. You can pass as many types as you want to create
def add_flash_types(*types)
  types.each do |type|
    next if _flash_types.include?(type)
    define_method(type) do
      request.flash[type]
    end
    helper_method(type) if respond_to?(:helper_method)
    self._flash_types += [type]
  end
end