~ubuntu-branches/ubuntu/raring/ruby-actionpack-3.2/raring

« back to all changes in this revision

Viewing changes to lib/action_controller/metal/flash.rb

  • Committer: Package Import Robot
  • Author(s): Ondřej Surý
  • Date: 2012-04-25 09:14:01 UTC
  • Revision ID: package-import@ubuntu.com-20120425091401-3nkf83btcemhjquo
Tags: upstream-3.2.3
Import upstream version 3.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
module ActionController #:nodoc:
 
2
  module Flash
 
3
    extend ActiveSupport::Concern
 
4
 
 
5
    included do
 
6
      delegate :flash, :to => :request
 
7
      delegate :alert, :notice, :to => "request.flash"
 
8
      helper_method :alert, :notice
 
9
    end
 
10
 
 
11
    protected
 
12
      def redirect_to(options = {}, response_status_and_flash = {}) #:doc:
 
13
        if alert = response_status_and_flash.delete(:alert)
 
14
          flash[:alert] = alert
 
15
        end
 
16
 
 
17
        if notice = response_status_and_flash.delete(:notice)
 
18
          flash[:notice] = notice
 
19
        end
 
20
 
 
21
        if other_flashes = response_status_and_flash.delete(:flash)
 
22
          flash.update(other_flashes)
 
23
        end
 
24
 
 
25
        super(options, response_status_and_flash)
 
26
      end
 
27
  end
 
28
end