instance method
destroy
Ruby on Rails 2.3.18
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
destroy()
Deletes the record in the database and freezes this instance to reflect that no changes should be made (since they can’t be persisted).
Source
# File activerecord/lib/active_record/base.rb, line 2623
def destroy
unless new_record?
connection.delete(
"DELETE FROM #{self.class.quoted_table_name} " +
"WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quoted_id}",
"#{self.class.name} Destroy"
)
end
@destroyed = true
freeze
end
Defined in activerecord/lib/active_record/base.rb line 2623
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Base