The newly created Active Record object
is returned regardless of whether the save succeeded.
decrement_counter(counter_name, id)
This method works just like the increment_counter(counter_name, id) method, but it decrements
the counter instead.
delete(id)
This method deletes the database record with the given id but does not instantiate the object
first. Therefore, the destroy method and any other callbacks are not triggered. If an array of
IDs is provided, all of the records matching the IDs are deleted.
APPENDIX ?– ACTIVE RECORD METHODS IN DETAIL 217
delete_all(conditions = nil)
This method deletes all of the database records that match the given conditions but does not
instantiate the objects first. Therefore, the destroy method and any other callbacks are not
triggered. The format of conditions is the same as those given to the find method. If no conditions
are specified, all of the database records for this class will be removed.
destroy(id)
destroy removes the database record associated with the given primary key by first instantiating
the object and then calling the destroy method on the object.
Pages:
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490