Permalink
Browse files

Merge [6422] from trunk. Undeprecates verification with :redirect_to …

…=> :named_route. References #7525.

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-stable@6423 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent d10177d commit 93d7ab48a102c84ab918d4df60cea5913ebef3a3 @jeremy jeremy committed Mar 14, 2007
View
5 actionpack/CHANGELOG
@@ -1,3 +1,8 @@
+*SVN*
+
+* Deprecation: verification with :redirect_to => :named_route shouldn't be deprecated. #7525 [Justin French]
+
+
*1.13.3* (March 12th, 2007)
* Fix a bug in Routing where a parameter taken from the path of the current request could not be used as a query parameter for the next. #6752 [Nicholas Seckar]
View
1 actionpack/lib/action_controller/verification.rb
@@ -95,6 +95,7 @@ def verify_action(options) #: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
View
15 actionpack/test/controller/verification_test.rb
@@ -34,9 +34,16 @@ class TestController < ActionController::Base
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 @@ def setup
@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

0 comments on commit 93d7ab4

Please sign in to comment.