From 900a2d304a83bad7a3958464b8dfa6fb49670686 Mon Sep 17 00:00:00 2001 From: Carlhuda Date: Thu, 4 Mar 2010 17:43:46 -0800 Subject: Get rid of relative_url_path in favor of respecting SCRIPT_NAME. Also added a way to specify a default SCRIPT_NAME when generating URLs out of the context of a request. --- actionpack/lib/action_dispatch/routing/url_for.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch/routing/url_for.rb') diff --git a/actionpack/lib/action_dispatch/routing/url_for.rb b/actionpack/lib/action_dispatch/routing/url_for.rb index 7f2c9a5c12..afbb2ecf16 100644 --- a/actionpack/lib/action_dispatch/routing/url_for.rb +++ b/actionpack/lib/action_dispatch/routing/url_for.rb @@ -101,7 +101,11 @@ module ActionDispatch # end def url_options - self.class.default_url_options.merge(@url_options || {}) + @url_options ||= begin + opts = self.class.default_url_options + opts.merge(:script_name => _router.script_name) if respond_to?(:_router) + opts + end end def url_options=(options) -- cgit v1.2.3