aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-09-09 21:54:59 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-09-09 21:54:59 +0000
commit6b0a6472365a7b9c3883d2de3ae19b49e77c847f (patch)
tree62f851b659add70bbfaeb30b15da64c198b488ed
parentb7c565dc626dda5cdd8ef041edc27fec08ac541b (diff)
downloadrails-6b0a6472365a7b9c3883d2de3ae19b49e77c847f.tar.gz
rails-6b0a6472365a7b9c3883d2de3ae19b49e77c847f.tar.bz2
rails-6b0a6472365a7b9c3883d2de3ae19b49e77c847f.zip
Removed ActionController::Base#keep_flash (use flash.keep instead)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7428 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/lib/action_controller/flash.rb26
-rw-r--r--actionpack/test/controller/flash_test.rb4
2 files changed, 12 insertions, 18 deletions
diff --git a/actionpack/lib/action_controller/flash.rb b/actionpack/lib/action_controller/flash.rb
index 314d32e9f5..b3e39912ce 100644
--- a/actionpack/lib/action_controller/flash.rb
+++ b/actionpack/lib/action_controller/flash.rb
@@ -1,8 +1,8 @@
module ActionController #:nodoc:
# The flash provides a way to pass temporary objects between actions. Anything you place in the flash will be exposed
- # to the very next action and then cleared out. This is a great way of doing notices and alerts, such as a create action
- # that sets <tt>flash[:notice] = "Successfully created"</tt> before redirecting to a display action that can then expose
- # the flash to its template. Actually, that exposure is automatically done. Example:
+ # to the very next action and then cleared out. This is a great way of doing notices and alerts, such as a create
+ # action that sets <tt>flash[:notice] = "Successfully created"</tt> before redirecting to a display action that can
+ # then expose the flash to its template. Actually, that exposure is automatically done. Example:
#
# class WeblogController < ActionController::Base
# def create
@@ -19,8 +19,8 @@ module ActionController #:nodoc:
# display.erb
# <% if flash[:notice] %><div class="notice"><%= flash[:notice] %></div><% end %>
#
- # This example just places a string in the flash, but you can put any object in there. And of course, you can put as many
- # as you like at a time too. Just remember: They'll be gone by the time the next action has been performed.
+ # This example just places a string in the flash, but you can put any object in there. And of course, you can put as
+ # many as you like at a time too. Just remember: They'll be gone by the time the next action has been performed.
#
# See docs on the FlashHash class for more details about the flash.
module Flash
@@ -85,7 +85,7 @@ module ActionController #:nodoc:
#
# Entries set via <tt>now</tt> are accessed the same way as standard entries: <tt>flash['my-key']</tt>.
def now
- FlashNow.new self
+ FlashNow.new(self)
end
# Keeps either the entire current flash or a specific flash entry available for the next action:
@@ -117,7 +117,8 @@ module ActionController #:nodoc:
end
end
- (@used.keys - keys).each{|k| @used.delete k } # clean up after keys that could have been left over by calling reject! or shift on the flash
+ # clean up after keys that could have been left over by calling reject! or shift on the flash
+ (@used.keys - keys).each{ |k| @used.delete(k) }
end
private
@@ -130,13 +131,12 @@ module ActionController #:nodoc:
unless k.nil?
@used[k] = v
else
- keys.each{|key| use key, v }
+ keys.each{ |key| use(key, v) }
end
end
end
module InstanceMethods #:nodoc:
-
protected
def reset_session_with_flash
reset_session_without_flash
@@ -163,12 +163,6 @@ module ActionController #:nodoc:
@_flash
end
- # deprecated. use <tt>flash.keep</tt> instead
- def keep_flash #:doc:
- ActiveSupport::Deprecation.warn 'keep_flash is deprecated; use flash.keep instead.', caller
- flash.keep
- end
-
private
def assign_shortcuts_with_flash(request, response) #:nodoc:
assign_shortcuts_without_flash(request, response)
@@ -181,4 +175,4 @@ module ActionController #:nodoc:
end
end
end
-end
+end \ No newline at end of file
diff --git a/actionpack/test/controller/flash_test.rb b/actionpack/test/controller/flash_test.rb
index 496af2b47a..35ab1b9d3c 100644
--- a/actionpack/test/controller/flash_test.rb
+++ b/actionpack/test/controller/flash_test.rb
@@ -31,7 +31,7 @@ class FlashTest < Test::Unit::TestCase
def use_flash_and_keep_it
@flash_copy = {}.update flash
@flashy = flash["that"]
- silence_warnings { keep_flash }
+ flash.keep
render :inline => "hello"
end
@@ -94,7 +94,7 @@ class FlashTest < Test::Unit::TestCase
def test_keep_flash
get :set_flash
- assert_deprecated(/keep_flash/) { get :use_flash_and_keep_it }
+ get :use_flash_and_keep_it
assert_equal "hello", @response.template.assigns["flash_copy"]["that"]
assert_equal "hello", @response.template.assigns["flashy"]