aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorBen Moss <ben@mossity.com>2013-03-09 14:54:19 -0500
committerBen Moss <ben@mossity.com>2013-03-09 15:16:15 -0500
commit992d87db02507363a4ad4ab40a3e4c4b32cf0408 (patch)
tree9802314e8600e0bd5640538e00fd581c6cdf7e79 /activerecord/lib/active_record/associations
parentca35454b498657cd94cb0a4203801e52687aa9e0 (diff)
downloadrails-992d87db02507363a4ad4ab40a3e4c4b32cf0408.tar.gz
rails-992d87db02507363a4ad4ab40a3e4c4b32cf0408.tar.bz2
rails-992d87db02507363a4ad4ab40a3e4c4b32cf0408.zip
Deprecate #connection in favour of accessing it via the class
This allows end-users to have a `connection` method on their models without clashing with ActiveRecord internals.
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
index 93618721bb..bb3e3db379 100644
--- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
+++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
@@ -26,7 +26,7 @@ module ActiveRecord
join_table[reflection.association_foreign_key] => record.id
)
- owner.connection.insert stmt
+ owner.class.connection.insert stmt
end
record
@@ -41,7 +41,7 @@ module ActiveRecord
def delete_records(records, method)
if sql = options[:delete_sql]
records = load_target if records == :all
- records.each { |record| owner.connection.delete(interpolate(sql, record)) }
+ records.each { |record| owner.class.connection.delete(interpolate(sql, record)) }
else
relation = join_table
condition = relation[reflection.foreign_key].eq(owner.id)
@@ -53,7 +53,7 @@ module ActiveRecord
)
end
- owner.connection.delete(relation.where(condition).compile_delete)
+ owner.class.connection.delete(relation.where(condition).compile_delete)
end
end