aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/url_for.rb
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-03-04 21:59:42 -0800
committerCarl Lerche <carllerche@mac.com>2010-03-04 22:00:30 -0800
commit9a17416d8bda0df0a6961e547c3cf1d677e66b5e (patch)
tree4c6dba8298cc9f1e1224521edc696e66aeda82f9 /actionpack/lib/action_dispatch/routing/url_for.rb
parent48672cd1997618f21f50e1204e60dc681e647ddb (diff)
downloadrails-9a17416d8bda0df0a6961e547c3cf1d677e66b5e.tar.gz
rails-9a17416d8bda0df0a6961e547c3cf1d677e66b5e.tar.bz2
rails-9a17416d8bda0df0a6961e547c3cf1d677e66b5e.zip
Tweak out url_for uses :script_name and add some tests
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/url_for.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/url_for.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/routing/url_for.rb b/actionpack/lib/action_dispatch/routing/url_for.rb
index afbb2ecf16..be5edcc120 100644
--- a/actionpack/lib/action_dispatch/routing/url_for.rb
+++ b/actionpack/lib/action_dispatch/routing/url_for.rb
@@ -102,14 +102,15 @@ module ActionDispatch
def url_options
@url_options ||= begin
- opts = self.class.default_url_options
- opts.merge(:script_name => _router.script_name) if respond_to?(:_router)
- opts
+ # self.class does not respond to default_url_options when the helpers are extended
+ # onto a singleton
+ self.class.respond_to?(:default_url_options) ? self.class.default_url_options : {}
end
end
def url_options=(options)
- @url_options = options
+ defaults = self.class.respond_to?(:default_url_options) ? self.class.default_url_options : {}
+ @url_options = defaults.merge(options)
end
# def merge_options(options) #:nodoc: