instance method
clear
Ruby on Rails 8.0.4
Since v4.0.13Signature
clear()
Equivalent to delete_all. The difference is that returns self, instead of an array with the deleted objects, so methods can be chained. See delete_all for more information. Note that because delete_all removes records by directly running an SQL query into the database, the updated_at column of the object is not changed.
Source
# File activerecord/lib/active_record/associations/collection_proxy.rb, line 1066
def clear
delete_all
self
end
Defined in activerecord/lib/active_record/associations/collection_proxy.rb line 1066
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Associations::CollectionProxy