aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-03-14 01:38:41 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-03-14 01:38:41 +0000
commit1f022710488aba694177bb4c33ad99f073eeabb2 (patch)
treede337e49d8c2c59daa07bf9034aaa95af01bdfb2 /actionpack
parent14cc8d2faf28f103c4f0c850be2bc45f15b5d1e6 (diff)
downloadrails-1f022710488aba694177bb4c33ad99f073eeabb2.tar.gz
rails-1f022710488aba694177bb4c33ad99f073eeabb2.tar.bz2
rails-1f022710488aba694177bb4c33ad99f073eeabb2.zip
Deprecation: verification with :redirect_to => :named_route shouldn't be deprecated. Closes #7525.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6422 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/verification.rb1
-rw-r--r--actionpack/test/controller/verification_test.rb15
3 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 59aba334b5..a4c0061da8 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Deprecation: verification with :redirect_to => :named_route shouldn't be deprecated. #7525 [Justin French]
+
* Cookie session store: raise ArgumentError when :session_key is blank. [Jeremy Kemper]
* Deprecation: remove deprecated request, redirect, and dependency methods. Remove deprecated instance variables. Remove deprecated url_for(:symbol, *args) and redirect_to(:symbol, *args) in favor of named routes. Remove uses_component_template_root for toplevel components directory. Privatize deprecated render_partial and render_partial_collection view methods. Remove deprecated link_to_image, link_image_to, update_element_function, start_form_tag, and end_form_tag helper methods. Remove deprecated human_size helper alias. [Jeremy Kemper]
diff --git a/actionpack/lib/action_controller/verification.rb b/actionpack/lib/action_controller/verification.rb
index 7cdf658437..131131a1d8 100644
--- a/actionpack/lib/action_controller/verification.rb
+++ b/actionpack/lib/action_controller/verification.rb
@@ -95,6 +95,7 @@ module ActionController #:nodoc:
response.headers.update(options[:add_headers]) if options[:add_headers]
unless performed?
render(options[:render]) if options[:render]
+ options[:redirect_to] = self.send(options[:redirect_to]) if options[:redirect_to].is_a? Symbol
redirect_to(options[:redirect_to]) if options[:redirect_to]
end
return false
diff --git a/actionpack/test/controller/verification_test.rb b/actionpack/test/controller/verification_test.rb
index 05012cf724..bbcd7d59d8 100644
--- a/actionpack/test/controller/verification_test.rb
+++ b/actionpack/test/controller/verification_test.rb
@@ -34,9 +34,16 @@ class VerificationTest < Test::Unit::TestCase
verify :only => :must_be_post, :method => :post, :render => { :status => 405, :text => "Must be post" }, :add_headers => { "Allow" => "POST" }
+ verify :only => :guarded_one_for_named_route_test, :params => "one",
+ :redirect_to => :foo_url
+
def guarded_one
render :text => "#{params[:one]}"
end
+
+ def guarded_one_for_named_route_test
+ render :text => "#{params[:one]}"
+ end
def guarded_with_flash
render :text => "#{params[:one]}"
@@ -94,6 +101,14 @@ class VerificationTest < Test::Unit::TestCase
@controller = TestController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
+ ActionController::Routing::Routes.add_named_route :foo, '/foo', :controller => 'test', :action => 'foo'
+ end
+
+ def test_no_deprecation_warning_for_named_route
+ assert_not_deprecated do
+ get :guarded_one_for_named_route_test, :two => "not one"
+ assert_redirected_to '/foo'
+ end
end
def test_guarded_one_with_prereqs