What should I use in my delete action: user.delete or user.destroy?

I am confused that there is an ActiveRecord removal as well as destruction.

In my controller, I want to delete a user in my delete action.

The result will be that this instance, represented by the user model, no longer exists in the database.

What method should I use for this?

+3
source share
1 answer

deletefaster because it bypasses callbacks, but for the same reason, it is less functional; destroy- This is a safer way if you do not know that callbacks are not needed in a particular case.

+5
source

Source: https://habr.com/ru/post/1709032/


All Articles