From d17b87919fae5850051bf7a173d3c6a84778f941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Fri, 14 Mar 2014 17:28:31 -0300 Subject: Fix the resolver cache and stop mutating the lookup_context Before we had a bug in the resolver cache so the disable_cache were not working when passing options to find --- actionview/lib/action_view/digestor.rb | 4 ++-- actionview/lib/action_view/lookup_context.rb | 17 ++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/digestor.rb b/actionview/lib/action_view/digestor.rb index abbfdc786e..c302bc15fa 100644 --- a/actionview/lib/action_view/digestor.rb +++ b/actionview/lib/action_view/digestor.rb @@ -122,8 +122,8 @@ module ActionView def template @template ||= begin - finder.with_formats_and_variants([format], [variant]) do - finder.disable_cache { finder.find(logical_name, [], partial?) } + finder.disable_cache do + finder.find(logical_name, [], partial?, [], formats: [format], variants: [variant]) end end end diff --git a/actionview/lib/action_view/lookup_context.rb b/actionview/lib/action_view/lookup_context.rb index d7f116c10c..855fed0190 100644 --- a/actionview/lib/action_view/lookup_context.rb +++ b/actionview/lib/action_view/lookup_context.rb @@ -159,7 +159,14 @@ module ActionView def detail_args_for(options) return @details, details_key if options.empty? # most common path. user_details = @details.merge(options) - [user_details, DetailsKey.get(user_details)] + + if @cache + details_key = DetailsKey.get(user_details) + else + details_key = nil + end + + [user_details, details_key] end # Support legacy foo.erb names even though we now ignore .erb @@ -246,13 +253,5 @@ module ActionView end end end - - def with_formats_and_variants(new_formats, new_variants) - old_formats, old_variants = formats, variants - self.formats, self.variants = new_formats, new_variants - yield - ensure - self.formats, self.variants = old_formats, old_variants - end end end -- cgit v1.2.3