diff options
Diffstat (limited to 'activerecord/lib/active_record/core.rb')
-rw-r--r-- | activerecord/lib/active_record/core.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index c29a0032bc..2379c09ea0 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -119,13 +119,7 @@ module ActiveRecord end def arel_engine - @arel_engine ||= begin - if self == ActiveRecord::Base - ActiveRecord::Base - else - connection_handler.connection_pools[name] ? self : active_record_super.arel_engine - end - end + @arel_engine ||= connection_handler.connection_pools[name] ? self : active_record_super.arel_engine end private @@ -304,6 +298,13 @@ module ActiveRecord @readonly = true end + # Returns the connection currently associated with the class. This can + # also be used to "borrow" the connection to do database work that isn't + # easily done without going straight to SQL. + def connection + self.class.connection + end + # Returns the contents of the record as a nicely formatted string. def inspect inspection = if @attributes |