Skip to content

Commit

Permalink
Fix destroy of has_many with has_many_inversing enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
amiryal committed Feb 5, 2024
1 parent 4f35409 commit 3bbdf59
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Associations
class HasManyAssociation
def delete_records(records, method)
if method == :destroy
records.each(&:destroy!)
records.reject(&:destroyed?).each(&:destroy!)
update_counter(-records.length) unless reflection.inverse_updates_counter_cache?
# CPK
elsif self.reflection.klass.composite?
Expand Down

0 comments on commit 3bbdf59

Please sign in to comment.