diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-02-26 15:00:33 -0800 |
---|---|---|
committer | Carlhuda <carlhuda@engineyard.com> | 2010-02-26 15:04:50 -0800 |
commit | 98f77e08278658ec47c9eb2e8f819d781c1eaebf (patch) | |
tree | 90fa876eb1f103ab9ca70602512c35ecc281a433 /actionpack/lib | |
parent | f10a019452d6864420dd15830073d93dd90de0f1 (diff) | |
download | rails-98f77e08278658ec47c9eb2e8f819d781c1eaebf.tar.gz rails-98f77e08278658ec47c9eb2e8f819d781c1eaebf.tar.bz2 rails-98f77e08278658ec47c9eb2e8f819d781c1eaebf.zip |
Rename named_url_helpers to url_helpers and url_helpers to url_for
Diffstat (limited to 'actionpack/lib')
4 files changed, 10 insertions, 11 deletions
diff --git a/actionpack/lib/action_controller/metal/url_for.rb b/actionpack/lib/action_controller/metal/url_for.rb index 013834ddee..6748cb7bd4 100644 --- a/actionpack/lib/action_controller/metal/url_for.rb +++ b/actionpack/lib/action_controller/metal/url_for.rb @@ -15,7 +15,7 @@ module ActionController def _router raise "In order to use #url_for, you must include the helpers of a particular " \ - "router. For instance, `include Rails.application.router.named_url_helpers" + "router. For instance, `include Rails.application.routes.url_helpers" end end end
\ No newline at end of file diff --git a/actionpack/lib/action_controller/railties/url_helpers.rb b/actionpack/lib/action_controller/railties/url_helpers.rb index e726535a4f..ad2a8d4ef3 100644 --- a/actionpack/lib/action_controller/railties/url_helpers.rb +++ b/actionpack/lib/action_controller/railties/url_helpers.rb @@ -5,7 +5,7 @@ module ActionController Module.new do define_method(:inherited) do |klass| super(klass) - klass.send(:include, router.named_url_helpers) + klass.send(:include, router.url_helpers) end end end diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 7bfe4fa2bf..47320883ac 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -259,9 +259,8 @@ module ActionDispatch named_routes.install(destinations, regenerate_code) end - # ROUTES TODO: Revisit the name of these methods - def url_helpers - @url_helpers ||= begin + def url_for + @url_for ||= begin router = self Module.new do extend ActiveSupport::Concern @@ -272,13 +271,13 @@ module ActionDispatch end end - def named_url_helpers - @named_url_helpers ||= begin + def url_helpers + @url_helpers ||= begin router = self Module.new do extend ActiveSupport::Concern - include router.url_helpers + include router.url_for # ROUTES TODO: install_helpers isn't great... can we make a module with the stuff that # we can include? diff --git a/actionpack/lib/action_dispatch/testing/assertions/routing.rb b/actionpack/lib/action_dispatch/testing/assertions/routing.rb index 5a3ff5a04c..5a9a20cc5b 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/routing.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/routing.rb @@ -145,14 +145,14 @@ module ActionDispatch old_routes, @router = @router, ActionDispatch::Routing::RouteSet.new old_controller, @controller = @controller, @controller.clone if @controller # ROUTES TODO: Figure out this insanity - silence_warnings { ::ActionController.const_set(:UrlFor, @router.named_url_helpers) } + silence_warnings { ::ActionController.const_set(:UrlFor, @router.url_helpers) } _router = @router - @controller.singleton_class.send(:send, :include, @router.named_url_helpers) if @controller + @controller.singleton_class.send(:send, :include, @router.url_helpers) if @controller yield @router ensure @router = old_routes @controller = old_controller if @controller - silence_warnings { ::ActionController.const_set(:UrlFor, @router.named_url_helpers) } if @router + silence_warnings { ::ActionController.const_set(:UrlFor, @router.url_helpers) } if @router end def method_missing(selector, *args, &block) |