1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/lib/action_controller/metal/flash.rb
2010-01-15 14:55:13 -06:00

28 lines
730 B
Ruby

module ActionController #:nodoc:
module Flash
extend ActiveSupport::Concern
included do
delegate :flash, :to => :request
delegate :alert, :notice, :to => "request.flash"
helper_method :alert, :notice
end
protected
def redirect_to(options = {}, response_status_and_flash = {}) #:doc:
if alert = response_status_and_flash.delete(:alert)
flash[:alert] = alert
end
if notice = response_status_and_flash.delete(:notice)
flash[:notice] = notice
end
if other_flashes = response_status_and_flash.delete(:flash)
flash.update(other_flashes)
end
super(options, response_status_and_flash)
end
end
end