From 50fbb7405665ba1c2b7c6f23574053a4764cef7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 1 Jan 2010 01:48:12 +0100 Subject: Fix inheritance issue with new callbacks. --- .../lib/active_support/core_ext/class/inheritable_attributes.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/core_ext/class') diff --git a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb index e4d22516c1..2b8e2b544f 100644 --- a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb +++ b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb @@ -159,7 +159,7 @@ class Class # (error out or do the same as other methods above) instead of silently # moving on). In particular, this makes the return value of this function # less useful. - def extlib_inheritable_reader(*ivars) + def extlib_inheritable_reader(*ivars, &block) options = ivars.extract_options! ivars.each do |ivar| @@ -178,6 +178,7 @@ class Class end RUBY end + instance_variable_set(:"@#{ivar}", yield) if block_given? end end -- cgit v1.2.3