In Ruby on Rails, is it @variable.delete
or @variable.destroy
To delete data or log files from a database Select the Files page. In the Database files grid, select the file to delete and then click Remove.
@variable.destroy
will call all callbacks (before_destroy etc.) as well as ensure associations are respected. @variable.delete
just calls the raw database query to delete the object. You're generally much safer off using destroy
even if it's more expensive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With