instance method delete

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

delete()

Deletes the record in the database and freezes this instance to reflect that no changes should be made (since they can’t be persisted). Returns the frozen instance.

The row is simply removed with a SQL DELETE statement on the record’s primary key, and no callbacks are executed.

To enforce the object’s before_destroy and after_destroy callbacks, Observer methods, or any :dependent association options, use #destroy.

Source
# File activerecord/lib/active_record/base.rb, line 2615
      def delete
        self.class.delete(id) unless new_record?
        @destroyed = true
        freeze
      end

Defined in activerecord/lib/active_record/base.rb line 2615 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Base

Type at least 2 characters to search.

↑↓ navigate · open · esc close