aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-07-29 11:32:17 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-07-29 11:32:17 -0700
commit41931b8af1324f0edf6754fbbfe66433b0b02cf1 (patch)
treefae0a19cb3d9602766852957d8f6824caa2ce9dc
parenta2e926698dfa9bb978958b181b3ed5c80fee8c6e (diff)
downloadrails-41931b8af1324f0edf6754fbbfe66433b0b02cf1.tar.gz
rails-41931b8af1324f0edf6754fbbfe66433b0b02cf1.tar.bz2
rails-41931b8af1324f0edf6754fbbfe66433b0b02cf1.zip
pass the module to define_named_route_methods
after this, we can disconnect @module from the instance
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index f735b9d1c7..aa0803e0e3 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -109,7 +109,7 @@ module ActionDispatch
def add(name, route)
routes[name.to_sym] = route
- define_named_route_methods(name, route)
+ define_named_route_methods(@module, name, route)
end
def get(name)
@@ -253,11 +253,11 @@ module ActionDispatch
#
# foo_url(bar, baz, bang, sort_by: 'baz')
#
- def define_url_helper(route, name, opts, route_key, url_strategy)
+ def define_url_helper(mod, route, name, opts, route_key, url_strategy)
helper = UrlHelper.create(route, opts, route_key, url_strategy)
- @module.remove_possible_method name
- @module.module_eval do
+ mod.remove_possible_method name
+ mod.module_eval do
define_method(name) do |*args|
options = nil
options = args.pop if args.last.is_a? Hash
@@ -268,9 +268,9 @@ module ActionDispatch
helpers << name
end
- def define_named_route_methods(name, route)
- define_url_helper route, :"#{name}_path", route.defaults, name, PATH
- define_url_helper route, :"#{name}_url", route.defaults, name, FULL
+ def define_named_route_methods(mod, name, route)
+ define_url_helper mod, route, :"#{name}_path", route.defaults, name, PATH
+ define_url_helper mod, route, :"#{name}_url", route.defaults, name, FULL
end
end