From 4d2470f7daad8cebd0a69f5ea0509a41af0596b8 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 9 Mar 2010 21:00:24 -0600 Subject: RouteSet#rewrite => url_for --- actionpack/lib/action_controller/test_case.rb | 2 +- actionpack/lib/action_dispatch/routing/route_set.rb | 3 +-- actionpack/lib/action_dispatch/routing/url_for.rb | 2 +- actionpack/test/controller/caching_test.rb | 4 ++-- actionpack/test/controller/url_rewriter_test.rb | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 072d289964..cdb5db32aa 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -345,7 +345,7 @@ module ActionController :relative_url_root => nil, :_path_segments => @request.symbolized_path_parameters) - url, query_string = @router.rewrite(options).split("?", 2) + url, query_string = @router.url_for(options).split("?", 2) @request.env["SCRIPT_NAME"] = @controller.config.relative_url_root @request.env["PATH_INFO"] = url diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index aa1e25aa8b..2b9fc9e0de 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -403,8 +403,7 @@ module ActionDispatch RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol, :port, :trailing_slash, :skip_relative_url_root] - # TODO: Terrible method name - def rewrite(options) + def url_for(options) handle_positional_args(options) rewritten_url = "" diff --git a/actionpack/lib/action_dispatch/routing/url_for.rb b/actionpack/lib/action_dispatch/routing/url_for.rb index 0ba04316d7..7ebd5e44e9 100644 --- a/actionpack/lib/action_dispatch/routing/url_for.rb +++ b/actionpack/lib/action_dispatch/routing/url_for.rb @@ -131,7 +131,7 @@ module ActionDispatch when String options when nil, Hash - _router.rewrite(url_options.merge(options || {})) + _router.url_for(url_options.merge(options || {})) else polymorphic_url(options) end diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 08efd5a48c..8a0c118d3c 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -81,9 +81,9 @@ class PageCachingTest < ActionController::TestCase match '/', :to => 'posts#index', :as => :main end @params[:format] = 'rss' - assert_equal '/posts.rss', @router.rewrite(@params) + assert_equal '/posts.rss', @router.url_for(@params) @params[:format] = nil - assert_equal '/', @router.rewrite(@params) + assert_equal '/', @router.url_for(@params) end end diff --git a/actionpack/test/controller/url_rewriter_test.rb b/actionpack/test/controller/url_rewriter_test.rb index cf775846df..7b46a48a1d 100644 --- a/actionpack/test/controller/url_rewriter_test.rb +++ b/actionpack/test/controller/url_rewriter_test.rb @@ -11,7 +11,7 @@ class UrlRewriterTests < ActionController::TestCase end def rewrite(router, options) - router.rewrite(@options.merge(options)) + router.url_for(@options.merge(options)) end end -- cgit v1.2.3