diff options
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/association_collection.rb | 8 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index b7f37e53f7..0ff91fbdf8 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -183,7 +183,13 @@ module ActiveRecord end - # Remove +records+ from this association. Does not destroy +records+. + # Removes +records+ from this association calling +before_remove+ and + # +after_remove+ callbacks. + # + # This method is abstract in the sense that +delete_records+ has to be + # provided by descendants. Note this method does not imply the records + # are actually removed from the database, that depends precisely on + # +delete_records+. They are in any case removed from the collection. def delete(*records) records = flatten_deeper(records) records.each { |record| raise_on_type_mismatch(record) } diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 3b2f306637..3348079e9d 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -61,6 +61,7 @@ module ActiveRecord record.save end + # Deletes the records according to the <tt>:dependent</tt> option. def delete_records(records) case @reflection.options[:dependent] when :destroy |