diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-02-24 16:01:03 -0800 |
---|---|---|
committer | Carlhuda <carlhuda@engineyard.com> | 2010-02-25 17:53:00 -0800 |
commit | 226dfc2681c98deaf14e4ae82e973d1d5caedd68 (patch) | |
tree | df761036bb714f3b9c10bb1eced20322aad953a7 /actionpack/lib/action_controller/url_rewriter.rb | |
parent | 76237f163ff7ad2a64af926030e3449c547cafa2 (diff) | |
download | rails-226dfc2681c98deaf14e4ae82e973d1d5caedd68.tar.gz rails-226dfc2681c98deaf14e4ae82e973d1d5caedd68.tar.bz2 rails-226dfc2681c98deaf14e4ae82e973d1d5caedd68.zip |
WIP: Remove the global router
Diffstat (limited to 'actionpack/lib/action_controller/url_rewriter.rb')
-rw-r--r-- | actionpack/lib/action_controller/url_rewriter.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb index 933a1fa8f9..272465d4f5 100644 --- a/actionpack/lib/action_controller/url_rewriter.rb +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -9,11 +9,11 @@ module ActionController @request, @parameters = request, parameters end - def rewrite(options = {}) + def rewrite(router, options = {}) options[:host] ||= @request.host_with_port options[:protocol] ||= @request.protocol - self.class.rewrite(options, @request.symbolized_path_parameters) do |options| + self.class.rewrite(router, options, @request.symbolized_path_parameters) do |options| process_path_options(options) end end @@ -24,7 +24,8 @@ module ActionController alias_method :to_s, :to_str - def self.rewrite(options, path_segments=nil) + # ROUTES TODO: Class method code smell + def self.rewrite(router, options, path_segments=nil) rewritten_url = "" unless options[:only_path] @@ -40,7 +41,7 @@ module ActionController path_options = options.except(*RESERVED_OPTIONS) path_options = yield(path_options) if block_given? - path = Routing::Routes.generate(path_options, path_segments || {}) + path = router.generate(path_options, path_segments || {}) rewritten_url << ActionController::Base.relative_url_root.to_s unless options[:skip_relative_url_root] rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path) |