diff options
-rw-r--r-- | arel.gemspec | 2 | ||||
-rw-r--r-- | lib/arel/algebra/core_extensions/object.rb | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/arel.gemspec b/arel.gemspec index 3a236d11b3..8091bec4d4 100644 --- a/arel.gemspec +++ b/arel.gemspec @@ -28,5 +28,5 @@ and query generation. # circular dependency chain. The solution is for ActiveRecord to release # the connection adapters which Arel uses in a separate gem # s.add_dependency "activerecord", ">= 3.0.pre" - s.add_dependency "activesupport", ">= 3.0.0.beta1" + s.add_dependency "activesupport", ">= 3.0.0.beta" end diff --git a/lib/arel/algebra/core_extensions/object.rb b/lib/arel/algebra/core_extensions/object.rb index 85a4d951a4..82fa28546c 100644 --- a/lib/arel/algebra/core_extensions/object.rb +++ b/lib/arel/algebra/core_extensions/object.rb @@ -12,6 +12,19 @@ module Arel yield(self) end + # TODO remove this when ActiveSupport beta1 is out. + # Returns the object's singleton class. + def singleton_class + class << self + self + end + end unless respond_to?(:singleton_class) + + # class_eval on an object acts like singleton_class_eval. + def class_eval(*args, &block) + singleton_class.class_eval(*args, &block) + end + Object.send(:include, self) end end |