Model Class
deleteByKey()
Signature
Section titled “Signature”deleteByKey() — returns boolean
Available in: model
Category: Delete Functions
Description
Section titled “Description”Finds the record with the supplied key and deletes it.
Returns true on successful deletion of the row, false otherwise.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
key | any | yes | — | Primary key value(s) of the record to fetch. Separate with comma if passing in multiple primary key values. Accepts a string, list, or a numeric value. |
reload | boolean | no | false | Set to true to force Wheels to query the database even though an identical query for this model may have been run in the same request. (The default in Wheels is to get the second query from the model’s request-level cache.) |
transaction | string | no | [runtime expression] | Set this to commit to update the database, rollback to run all the database queries but not commit them, or none to skip transaction handling altogether. |
callbacks | boolean | no | true | Set to false to disable callbacks for this method. |
includeSoftDeletes | boolean | no | false | Set to true to include soft-deleted records in the queries that this method runs. |
softDelete | boolean | no | true | Set to false to permanently delete a record, even if it has a soft delete column. |