delete_all(dependent = nil)public
Removes all records from the association without calling callbacks on the associated records. It honors the :dependent option. However if the :dependent value is :destroy then in that case the :delete_all deletion strategy for the association is applied.
You can force a particular deletion strategy by passing a parameter.
See delete for more info.
# File activerecord/lib/active_record/associations/collection_association.rb, line 200 def delete_all(dependent = nil) if dependent && ![:nullify, :delete_all].include?(dependent) raise ArgumentError, "Valid values are :nullify or :delete_all" end dependent = if dependent dependent elsif options[:dependent] == :destroy :delete_all else options[:dependent] end delete_or_nullify_all_records(dependent).tap do reset loaded! end end