aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2006-07-22 02:31:21 +0000
committerRick Olson <technoweenie@gmail.com>2006-07-22 02:31:21 +0000
commit04d9e94e88be0ba076b0fef980e8bde8e25061d9 (patch)
tree490b3d5aa23518fd8e0da335ce9390387b85a565
parent3a0159dd1e66a53d2ee39b3a3625998706cd8ae6 (diff)
downloadrails-04d9e94e88be0ba076b0fef980e8bde8e25061d9.tar.gz
rails-04d9e94e88be0ba076b0fef980e8bde8e25061d9.tar.bz2
rails-04d9e94e88be0ba076b0fef980e8bde8e25061d9.zip
Fixed that you can still access the flash after the flash has been reset in reset_session. Closes #5584 [lmarlow@yahoo.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4617 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/flash.rb3
-rw-r--r--actionpack/test/controller/flash_test.rb17
3 files changed, 21 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index ac729a512b..56b59862a4 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that you can still access the flash after the flash has been reset in reset_session. Closes #5584 [lmarlow@yahoo.com]
+
* Allow form_for and fields_for to work with indexed form inputs. [Jeremy Kemper, Matt Lyon]
<% form_for 'post[]', @post do |f| -%>
diff --git a/actionpack/lib/action_controller/flash.rb b/actionpack/lib/action_controller/flash.rb
index 5751fe6e93..623ce2f4ba 100644
--- a/actionpack/lib/action_controller/flash.rb
+++ b/actionpack/lib/action_controller/flash.rb
@@ -147,7 +147,8 @@ module ActionController #:nodoc:
def reset_session_with_flash
reset_session_without_flash
- @flash = nil
+ remove_instance_variable(:@flash)
+ flash(:refresh)
end
protected
diff --git a/actionpack/test/controller/flash_test.rb b/actionpack/test/controller/flash_test.rb
index 53d765efe4..a6ce3d11b7 100644
--- a/actionpack/test/controller/flash_test.rb
+++ b/actionpack/test/controller/flash_test.rb
@@ -35,6 +35,16 @@ class FlashTest < Test::Unit::TestCase
render :inline => "hello"
end
+ def use_flash_after_reset_session
+ flash["that"] = "hello"
+ @flashy_that = flash["that"]
+ reset_session
+ @flashy_that_reset = flash["that"]
+ flash["this"] = "good-bye"
+ @flashy_this = flash["this"]
+ render :inline => "hello"
+ end
+
def rescue_action(e)
raise unless ActionController::MissingTemplate === e
end
@@ -82,4 +92,11 @@ class FlashTest < Test::Unit::TestCase
assert_nil @response.template.assigns["flash_copy"]["foo"]
assert_nil @response.template.assigns["flashy"]
end
+
+ def test_flash_after_reset_session
+ get :use_flash_after_reset_session
+ assert_equal "hello", @response.template.assigns["flashy_that"]
+ assert_equal "good-bye", @response.template.assigns["flashy_this"]
+ assert_nil @response.template.assigns["flashy_that_reset"]
+ end
end \ No newline at end of file