diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2019-04-11 18:43:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-11 18:43:58 -0400 |
commit | 98e10c2deab755f49941676965cb8e30a843b4a5 (patch) | |
tree | 7d704c77ab07b929232c02048fac046138cfb52d /actionpack | |
parent | 032d4ad42cea834303a1fb9dccfda834ae42d221 (diff) | |
parent | fdfd9e399f440fc6b4bec7d16ae5114318aee1a9 (diff) | |
download | rails-98e10c2deab755f49941676965cb8e30a843b4a5.tar.gz rails-98e10c2deab755f49941676965cb8e30a843b4a5.tar.bz2 rails-98e10c2deab755f49941676965cb8e30a843b4a5.zip |
Merge pull request #35919 from Shopify/simplify-define_url_helper
Simplify and fasten NamedRouteCollection#define_url_helper
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index d0a7eadf45..4a24c35efb 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -317,18 +317,16 @@ module ActionDispatch # def define_url_helper(mod, route, name, opts, route_key, url_strategy) helper = UrlHelper.create(route, opts, route_key, url_strategy) - mod.module_eval do - define_method(name) do |*args| - last = args.last - options = \ - case last - when Hash - args.pop - when ActionController::Parameters - args.pop.to_h - end - helper.call self, args, options - end + mod.define_method(name) do |*args| + last = args.last + options = \ + case last + when Hash + args.pop + when ActionController::Parameters + args.pop.to_h + end + helper.call self, args, options end end end |