From d32965399ccfa2052a4d52b70db1bae0ca16830b Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 13 Jun 2009 01:01:42 +0200 Subject: uses Object#metaclass and Object#class_eval in a few spots [#2797 state:committed] Signed-off-by: Jeremy Kemper --- activerecord/lib/active_record/base.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/base.rb') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index c4d143ab05..1fc0c93732 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -11,6 +11,7 @@ require 'active_support/core_ext/hash/indifferent_access' require 'active_support/core_ext/hash/slice' require 'active_support/core_ext/string/behavior' require 'active_support/core_ext/symbol' +require 'active_support/core_ext/object/metaclass' module ActiveRecord #:nodoc: # Generic Active Record exception class. @@ -2040,7 +2041,7 @@ module ActiveRecord #:nodoc: # end # end def define_attr_method(name, value=nil, &block) - sing = class << self; self; end + sing = metaclass sing.send :alias_method, "original_#{name}", name if block_given? sing.send :define_method, name, &block -- cgit v1.2.3