Permalink
Browse files

RouteSet#rewrite => url_for

  • Loading branch information...
1 parent e38ea98 commit 4d2470f7daad8cebd0a69f5ea0509a41af0596b8 @josh josh committed Mar 10, 2010
@@ -345,7 +345,7 @@ def build_request_uri(action, parameters)
: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
@@ -403,8 +403,7 @@ def generate(options, recall = {}, extras = false)
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 = ""
@@ -131,7 +131,7 @@ def url_for(options = nil)
when String
options
when nil, Hash
- _router.rewrite(url_options.merge(options || {}))
+ _router.url_for(url_options.merge(options || {}))
else
polymorphic_url(options)
end
@@ -81,9 +81,9 @@ def test_page_caching_resources_saves_to_correct_path_with_extension_even_if_def
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
@@ -11,7 +11,7 @@ def initialize(request)
end
def rewrite(router, options)
- router.rewrite(@options.merge(options))
+ router.url_for(@options.merge(options))
end
end

0 comments on commit 4d2470f

Please sign in to comment.