1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Cache url_helpers

`url_helpers` used to be memoized. This was lost in a refactoring and
this PR adds it back. We noticed this while investigating why
integration tests are slower than controller tests.
This commit is contained in:
eileencodes 2015-02-01 14:30:59 -08:00
parent e6d8f435a9
commit 3b637802b2

View file

@ -410,6 +410,7 @@ module ActionDispatch
end end
def url_helpers(supports_path = true) def url_helpers(supports_path = true)
@url_helpers ||= begin
routes = self routes = self
Module.new do Module.new do
@ -467,6 +468,7 @@ module ActionDispatch
private :_generate_paths_by_default private :_generate_paths_by_default
end end
end end
end
def empty? def empty?
routes.empty? routes.empty?