Update to Rails 2.3.8
This commit is contained in:
parent
6677b46cb4
commit
f0635301aa
429 changed files with 17683 additions and 4047 deletions
|
@ -29,8 +29,13 @@ module ActionController #:nodoc:
|
|||
def self.included(base)
|
||||
base.class_eval do
|
||||
include InstanceMethods
|
||||
|
||||
alias_method_chain :perform_action, :flash
|
||||
alias_method_chain :reset_session, :flash
|
||||
alias_method_chain :redirect_to, :flash
|
||||
|
||||
helper_method :alert
|
||||
helper_method :notice
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -155,6 +160,22 @@ module ActionController #:nodoc:
|
|||
remove_instance_variable(:@_flash) if defined? @_flash
|
||||
end
|
||||
|
||||
def redirect_to_with_flash(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
|
||||
|
||||
redirect_to_without_flash(options, response_status_and_flash)
|
||||
end
|
||||
|
||||
# Access the contents of the flash. Use <tt>flash["notice"]</tt> to
|
||||
# read a notice you put there or <tt>flash["notice"] = "hello"</tt>
|
||||
# to put a new one.
|
||||
|
@ -166,6 +187,27 @@ module ActionController #:nodoc:
|
|||
|
||||
@_flash
|
||||
end
|
||||
|
||||
|
||||
# Convenience accessor for flash[:alert]
|
||||
def alert
|
||||
flash[:alert]
|
||||
end
|
||||
|
||||
# Convenience accessor for flash[:alert]=
|
||||
def alert=(message)
|
||||
flash[:alert] = message
|
||||
end
|
||||
|
||||
# Convenience accessor for flash[:notice]
|
||||
def notice
|
||||
flash[:notice]
|
||||
end
|
||||
|
||||
# Convenience accessor for flash[:notice]=
|
||||
def notice=(message)
|
||||
flash[:notice] = message
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue