diff options
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 4e743ec826..8750e226b9 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -747,7 +747,7 @@ module ActiveRecord #:nodoc: undefine_attribute_methods reset_column_cache @column_names = @content_columns = @dynamic_methods_hash = @inheritance_column = nil - @relation = nil + @arel_engine = @relation = nil end def reset_column_cache # :nodoc: @@ -856,7 +856,13 @@ module ActiveRecord #:nodoc: end def arel_engine - self + @arel_engine ||= begin + if self == ActiveRecord::Base + ActiveRecord::Base + else + connection_handler.connection_pools[name] ? self : superclass.arel_engine + end + end end # Returns a scope for this class without taking into account the default_scope. |