aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/routes_proxy.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2017-07-02 23:36:33 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2017-07-05 19:17:51 +0200
commitd3f9f6cd44c68e006865d4fc6d8e9583ddb44209 (patch)
tree17c9d30280df4b756c7bc5f58b72d88b473b8c77 /actionpack/lib/action_dispatch/routing/routes_proxy.rb
parent2ae84d2fa09af85166f35ca44238a6a20d3c1554 (diff)
downloadrails-d3f9f6cd44c68e006865d4fc6d8e9583ddb44209.tar.gz
rails-d3f9f6cd44c68e006865d4fc6d8e9583ddb44209.tar.bz2
rails-d3f9f6cd44c68e006865d4fc6d8e9583ddb44209.zip
Allow mounting same engine under several locations
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/routes_proxy.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/routes_proxy.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/routes_proxy.rb b/actionpack/lib/action_dispatch/routing/routes_proxy.rb
index c1423f770f..7a6c2e95d8 100644
--- a/actionpack/lib/action_dispatch/routing/routes_proxy.rb
+++ b/actionpack/lib/action_dispatch/routing/routes_proxy.rb
@@ -8,9 +8,10 @@ module ActionDispatch
attr_accessor :scope, :routes
alias :_routes :routes
- def initialize(routes, scope, helpers)
+ def initialize(routes, scope, helpers, script_namer = nil)
@routes, @scope = routes, scope
@helpers = helpers
+ @script_namer = script_namer
end
def url_options
@@ -29,7 +30,9 @@ module ActionDispatch
self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{method}(*args)
options = args.extract_options!
- args << url_options.merge((options || {}).symbolize_keys)
+ options = url_options.merge((options || {}).symbolize_keys)
+ options.reverse_merge!(script_name: @script_namer.call(options)) if @script_namer
+ args << options
@helpers.#{method}(*args)
end
RUBY