2004-11-23 20:04:44 -05:00
|
|
|
module ActionController #:nodoc:
|
|
|
|
module Flash
|
2009-05-28 12:35:36 -04:00
|
|
|
extend ActiveSupport::Concern
|
2009-05-20 19:38:48 -04:00
|
|
|
|
2009-12-17 19:37:11 -05:00
|
|
|
included do
|
2010-01-15 15:44:27 -05:00
|
|
|
delegate :flash, :to => :request
|
|
|
|
delegate :alert, :notice, :to => "request.flash"
|
2009-12-17 19:37:11 -05:00
|
|
|
helper_method :alert, :notice
|
|
|
|
end
|
|
|
|
|
2009-12-28 19:28:26 -05:00
|
|
|
protected
|
|
|
|
def redirect_to(options = {}, response_status_and_flash = {}) #:doc:
|
|
|
|
if alert = response_status_and_flash.delete(:alert)
|
|
|
|
flash[:alert] = alert
|
|
|
|
end
|
2009-12-20 21:00:04 -05:00
|
|
|
|
2009-12-28 19:28:26 -05:00
|
|
|
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
|
2004-11-23 20:04:44 -05:00
|
|
|
end
|
2007-10-02 01:32:14 -04:00
|
|
|
end
|