diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-07-29 11:28:45 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-07-29 11:28:45 -0700 |
commit | a2e926698dfa9bb978958b181b3ed5c80fee8c6e (patch) | |
tree | 8ea372a2a0ffe672ac9c205f2bb6af0405a2630c /actionpack/lib/action_dispatch/routing | |
parent | d2d33769030b3a560bdbc9c33e7c189274a0dc3a (diff) | |
download | rails-a2e926698dfa9bb978958b181b3ed5c80fee8c6e.tar.gz rails-a2e926698dfa9bb978958b181b3ed5c80fee8c6e.tar.bz2 rails-a2e926698dfa9bb978958b181b3ed5c80fee8c6e.zip |
only ask for the routes module once
we can cache the module on the stack, then reuse it
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 7259b01c99..f735b9d1c7 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -401,14 +401,16 @@ module ActionDispatch def url_options; {}; end end + route_methods = routes.named_routes.module + # Make named_routes available in the module singleton # as well, so one can do: # Rails.application.routes.url_helpers.posts_path - extend routes.named_routes.module + extend route_methods # Any class that includes this module will get all # named routes... - include routes.named_routes.module + include route_methods # plus a singleton class method called _routes ... included do |