From 8b4461c1a405e52e22ee05dd8b46168402d02968 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 8 Sep 2008 19:43:52 -0700 Subject: [PATCH] Check whether memoized ivar is initialized --- activesupport/lib/active_support/memoizable.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/memoizable.rb b/activesupport/lib/active_support/memoizable.rb index 6506238ac0..4786fd6e0b 100644 --- a/activesupport/lib/active_support/memoizable.rb +++ b/activesupport/lib/active_support/memoizable.rb @@ -60,7 +60,7 @@ module ActiveSupport #{memoized_ivar} ||= {} unless frozen? reload = args.pop if args.last == true || args.last == :reload - if #{memoized_ivar} + if defined?(#{memoized_ivar}) && #{memoized_ivar} if !reload && #{memoized_ivar}.has_key?(args) #{memoized_ivar}[args] elsif #{memoized_ivar}