From d48ebeade2d907573e3fb086495b57b10115066c Mon Sep 17 00:00:00 2001 From: Jay Pignata Date: Fri, 4 Sep 2009 17:28:36 -0400 Subject: Escaping symbol passed into Memoizable's flush_cache for query methods to allow them to be cleared Signed-off-by: Michael Koziarski [#3138 state:committed] --- activesupport/lib/active_support/memoizable.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/memoizable.rb b/activesupport/lib/active_support/memoizable.rb index 7724b9d88b..b197fbc9bf 100644 --- a/activesupport/lib/active_support/memoizable.rb +++ b/activesupport/lib/active_support/memoizable.rb @@ -57,10 +57,10 @@ module ActiveSupport end end - def flush_cache(*syms, &block) + def flush_cache(*syms) syms.each do |sym| (methods + private_methods + protected_methods).each do |m| - if m.to_s =~ /^_unmemoized_(#{sym})/ + if m.to_s =~ /^_unmemoized_(#{sym.to_s.gsub(/\?\Z/, '\?')})/ ivar = ActiveSupport::Memoizable.memoized_ivar_for($1) instance_variable_get(ivar).clear if instance_variable_defined?(ivar) end -- cgit v1.2.3