Skip to content
Browse files

pass the module to define_named_route_methods

after this, we can disconnect @module from the instance
  • Loading branch information...
1 parent a2e9266 commit 41931b8af1324f0edf6754fbbfe66433b0b02cf1 @tenderlove tenderlove committed Jul 29, 2014
Showing with 7 additions and 7 deletions.
  1. +7 −7 actionpack/lib/action_dispatch/routing/route_set.rb
View
14 actionpack/lib/action_dispatch/routing/route_set.rb
@@ -109,7 +109,7 @@ def clear!
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 @@ def handle_positional_args(controller_options, inner_options, args, result, path
#
# 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 @@ def define_url_helper(route, name, opts, route_key, url_strategy)
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

0 comments on commit 41931b8

Please sign in to comment.
Something went wrong with that request. Please try again.