aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_many_association.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-07-16 17:45:28 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-07-16 17:45:28 -0500
commit73ade4fe100ae7f48c5f95dcdf7067f6a0cd51fa (patch)
tree2f1601292978a844226e16f3cef428ed760b9eb5 /activerecord/lib/active_record/associations/has_many_association.rb
parent8fe01de2e8753d045408ecde3178ab4e9192bf9a (diff)
parent90c930f45c5c6766306929241462ffff8f67b86e (diff)
downloadrails-73ade4fe100ae7f48c5f95dcdf7067f6a0cd51fa.tar.gz
rails-73ade4fe100ae7f48c5f95dcdf7067f6a0cd51fa.tar.bz2
rails-73ade4fe100ae7f48c5f95dcdf7067f6a0cd51fa.zip
Resolved conflict
Diffstat (limited to 'activerecord/lib/active_record/associations/has_many_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_many_association.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb
index 37440aa84d..e6fa15c173 100644
--- a/activerecord/lib/active_record/associations/has_many_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_association.rb
@@ -19,6 +19,14 @@ module ActiveRecord
end
protected
+ def owner_quoted_id
+ if @reflection.options[:primary_key]
+ quote_value(@owner.send(@reflection.options[:primary_key]))
+ else
+ @owner.quoted_id
+ end
+ end
+
def count_records
count = if has_cached_counter?
@owner.send(:read_attribute, cached_counter_attribute_name)
@@ -53,9 +61,9 @@ module ActiveRecord
def delete_records(records)
case @reflection.options[:dependent]
when :destroy
- records.each(&:destroy)
+ records.each { |r| r.destroy }
when :delete_all
- @reflection.klass.delete(records.map(&:id))
+ @reflection.klass.delete(records.map { |record| record.id })
else
ids = quoted_record_ids(records)
@reflection.klass.update_all(