diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index b9bfb8ccd6ed7b9ca6a4cb148a5fbbea1904a560..359e53d1983d5bc7e42036a96cd689ddcdf94cb4 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 9ce3c31de870247c2d23cf14f7c97d558bb8c494..2f7919cc07b2651f3d025d7baeb4a476d81088be 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -553,22 +553,14 @@ def process(request, response, method = :perform_action, *arguments) #:nodoc: # # This takes the current URL as is and only exchanges the action. In contrast, url_for :action => 'print' # 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 3256b774775945fd981280b41b8c20cfc55b2ae0..7c6afd358f16faff8ba312368f45c54d2b9e9dfa 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 @@ 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 @@ def setup @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 575532c1bebcc1a36a556868af1de3f0b19042d6..df037ec28d3dba4b16ba3fd89bbe9bd38db95d92 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 @@ def test_simple_redirect 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 @@ def setup @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 ab44fbf3ca34e2de967a0b12b2bdef9673c801de..e2f78ad30cc5ab36fc70c77b86b1d4d6714979cc 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -54,10 +54,6 @@ def test_file_upload 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 @@ def test_test_uploaded_file_exception_when_file_doesnt_exist 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