diff options
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rwxr-xr-x | actionpack/lib/action_controller/base.rb | 16 | ||||
-rw-r--r-- | actionpack/test/controller/deprecation/deprecated_base_methods_test.rb | 12 | ||||
-rwxr-xr-x | actionpack/test/controller/redirect_test.rb | 22 | ||||
-rw-r--r-- | actionpack/test/controller/test_test.rb | 14 |
5 files changed, 8 insertions, 58 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index b9bfb8ccd6..359e53d198 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,6 +1,6 @@ *SVN* -* Deprecation: remove deprecated request, redirect, and dependency methods. Remove deprecated instance variables. 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] +* 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] * Consistent public/protected/private visibility for chained methods. #7813 [Dan Manges] diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 9ce3c31de8..2f7919cc07 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -553,22 +553,14 @@ module ActionController #:nodoc: # # This takes the current URL as is and only exchanges the action. In contrast, <tt>url_for :action => 'print'</tt> # would have slashed-off the path components after the changed action. - def url_for(options = {}, *parameters_for_method_reference) #:doc: - case options + def url_for(options = nil) #:doc: + case options || {} when String options - - when Symbol - ActiveSupport::Deprecation.warn( - "You called url_for(:#{options}), which is a deprecated API call. Instead you should use the named " + - "route directly, like #{options}(). Using symbols and parameters with url_for will be removed from Rails 2.0.", - caller - ) - - send(options, *parameters_for_method_reference) - when Hash @url.rewrite(rewrite_options(options)) + else + raise ArgumentError, "Unrecognized url_for options: #{options.inspect}" end end diff --git a/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb b/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb index 3256b77477..7c6afd358f 100644 --- a/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb +++ b/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb @@ -2,10 +2,6 @@ require File.dirname(__FILE__) + '/../../abstract_unit' class DeprecatedBaseMethodsTest < Test::Unit::TestCase class Target < ActionController::Base - def deprecated_symbol_parameter_to_url_for - redirect_to(url_for(:home_url, "superstars")) - end - def deprecated_render_parameters render "fun/games/hello_world" end @@ -29,14 +25,6 @@ class DeprecatedBaseMethodsTest < Test::Unit::TestCase @controller = Target.new end - def test_deprecated_symbol_parameter_to_url_for - assert_deprecated("url_for(:home_url)") do - get :deprecated_symbol_parameter_to_url_for - end - - assert_redirected_to "http://example.com/superstars" - end - def test_deprecated_render_parameters assert_deprecated("render('fun/games/hello_world')") do get :deprecated_render_parameters diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb index 575532c1be..df037ec28d 100755 --- a/actionpack/test/controller/redirect_test.rb +++ b/actionpack/test/controller/redirect_test.rb @@ -4,11 +4,7 @@ class RedirectController < ActionController::Base def simple_redirect redirect_to :action => "hello_world" end - - def method_redirect - redirect_to :dashbord_url, 1, "hello" - end - + def host_redirect redirect_to :action => "other_host", :only_path => false, :host => 'other.test.host' end @@ -49,12 +45,6 @@ class RedirectTest < Test::Unit::TestCase assert_equal "http://test.host/redirect/hello_world", redirect_to_url end - def test_redirect_with_method_reference_and_parameters - assert_deprecated(/redirect_to/) { get :method_redirect } - assert_response :redirect - assert_equal "http://test.host/redirect/dashboard/1?message=hello", redirect_to_url - end - def test_simple_redirect_using_options get :host_redirect assert_response :redirect @@ -122,19 +112,13 @@ module ModuleTest @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new end - + def test_simple_redirect get :simple_redirect assert_response :redirect assert_equal "http://test.host/module_test/module_redirect/hello_world", redirect_to_url end - - def test_redirect_with_method_reference_and_parameters - assert_deprecated(/redirect_to/) { get :method_redirect } - assert_response :redirect - assert_equal "http://test.host/module_test/module_redirect/dashboard/1?message=hello", redirect_to_url - end - + def test_simple_redirect_using_options get :host_redirect assert_response :redirect diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index ab44fbf3ca..e2f78ad30c 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -54,10 +54,6 @@ HTML render :text => params[:file].size end - def redirect_to_symbol - redirect_to :generate_url, :id => 5 - end - def redirect_to_same_controller redirect_to :controller => 'test', :action => 'test_uri', :id => 5 end @@ -440,16 +436,6 @@ HTML assert_raise(RuntimeError) { ActionController::TestUploadedFile.new('non_existent_file') } end - def test_assert_redirected_to_symbol - with_foo_routing do |set| - assert_deprecated(/generate_url.*redirect_to/) do - get :redirect_to_symbol - end - assert_response :redirect - assert_redirected_to :generate_url - end - end - def test_assert_follow_redirect_to_same_controller with_foo_routing do |set| get :redirect_to_same_controller |