Permalink
Browse files

Extract named_helper module_eval so it's easier to override

  • Loading branch information...
1 parent b546886 commit 8b10c3ecb0a2dfde81ec8e4cac322e46ad9b66fd @jeremy jeremy committed Nov 30, 2008
Showing with 6 additions and 2 deletions.
  1. +6 −2 actionpack/lib/action_controller/routing/route_set.rb
@@ -136,9 +136,13 @@ def define_named_route_methods(name, route)
end
end
+ def named_helper_module_eval(code, *args)
+ @module.module_eval(code, *args)
+ end
+
def define_hash_access(route, name, kind, options)
selector = hash_access_name(name, kind)
- @module.module_eval <<-end_eval # We use module_eval to avoid leaks
+ named_helper_module_eval <<-end_eval # We use module_eval to avoid leaks
def #{selector}(options = nil)
options ? #{options.inspect}.merge(options) : #{options.inspect}
end
@@ -166,7 +170,7 @@ def define_url_helper(route, name, kind, options)
#
# foo_url(bar, baz, bang, :sort_by => 'baz')
#
- @module.module_eval <<-end_eval # We use module_eval to avoid leaks
+ named_helper_module_eval <<-end_eval # We use module_eval to avoid leaks
def #{selector}(*args)
#{generate_optimisation_block(route, kind)}

0 comments on commit 8b10c3e

Please sign in to comment.