diff options
author | Kevin Casey <kacasey@berkeley.edu> | 2014-02-02 11:47:06 -0800 |
---|---|---|
committer | Kevin Casey <kacasey@berkeley.edu> | 2014-02-02 11:47:06 -0800 |
commit | 00ebbb79456dccd45d813886d81f1619c0161af4 (patch) | |
tree | c1a1fce780704382afc85a6abe8a12efa5c09d65 /activerecord/lib/active_record/associations | |
parent | f484df79f26bca7e952f907878074eddbf72656d (diff) | |
download | rails-00ebbb79456dccd45d813886d81f1619c0161af4.tar.gz rails-00ebbb79456dccd45d813886d81f1619c0161af4.tar.bz2 rails-00ebbb79456dccd45d813886d81f1619c0161af4.zip |
fix HABTM w/out primary key errors on destruction
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 72e0891702..6457182195 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -111,7 +111,7 @@ module ActiveRecord records.each(&:destroy!) update_counter(-records.length) unless inverse_updates_counter_cache? else - if records == :all + if records == :all || !reflection.klass.primary_key scope = self.scope else scope = self.scope.where(reflection.klass.primary_key => records) |