From a2e926698dfa9bb978958b181b3ed5c80fee8c6e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 29 Jul 2014 11:28:45 -0700 Subject: [PATCH] only ask for the routes module once we can cache the module on the stack, then reuse it --- actionpack/lib/action_dispatch/routing/route_set.rb | 6 ++++-- 1 file 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 7259b01c992..f735b9d1c77 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