aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/url_helper.rb
diff options
context:
space:
mode:
authorSergey Nartimov + José Valim <jose.valim@gmail.com>2012-03-02 15:01:20 +0100
committerJosé Valim <jose.valim@gmail.com>2012-03-02 15:01:20 +0100
commitcd5dabab95924dfaf3af8c429454f1a46d9665c1 (patch)
tree41200dffbf8bf0ec0d6ff2068c19566771eef541 /actionpack/lib/action_view/helpers/url_helper.rb
parentd7014bc7eaa62c36f045a503cdad64e4ebbc2687 (diff)
downloadrails-cd5dabab95924dfaf3af8c429454f1a46d9665c1.tar.gz
rails-cd5dabab95924dfaf3af8c429454f1a46d9665c1.tar.bz2
rails-cd5dabab95924dfaf3af8c429454f1a46d9665c1.zip
Optimize url helpers.
Diffstat (limited to 'actionpack/lib/action_view/helpers/url_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb23
1 files changed, 14 insertions, 9 deletions
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb
index 8d7417809b..f4946e65b5 100644
--- a/actionpack/lib/action_view/helpers/url_helper.rb
+++ b/actionpack/lib/action_view/helpers/url_helper.rb
@@ -23,20 +23,25 @@ module ActionView
include ActionDispatch::Routing::UrlFor
include TagHelper
- def _routes_context
- controller
- end
+ # We need to override url_optoins, _routes_context
+ # and optimize_routes_generation? to consider the controller.
- # Need to map default url options to controller one.
- # def default_url_options(*args) #:nodoc:
- # controller.send(:default_url_options, *args)
- # end
- #
- def url_options
+ def url_options #:nodoc:
return super unless controller.respond_to?(:url_options)
controller.url_options
end
+ def _routes_context #:nodoc:
+ controller
+ end
+ protected :_routes_context
+
+ def optimize_routes_generation? #:nodoc:
+ controller.respond_to?(:optimize_routes_generation?) ?
+ controller.optimize_routes_generation? : super
+ end
+ protected :optimize_routes_generation?
+
# Returns the URL for the set of +options+ provided. This takes the
# same options as +url_for+ in Action Controller (see the
# documentation for <tt>ActionController::Base#url_for</tt>). Note that by default