ruby-on-rails - users - rails soft delete
How to “soft delete” user with Devise (3)
A complete tutorial can be found at Soft Delete a Devise User Account on the Devise wiki page.
1. Add a "deleted_at" DATETIME column
2. Override users/registrations#destroy in your routes
3. Override users/registrations#destroy in the registrations controller
4. Update user model with a soft_delete & check if user is active on authentication
5. Add a custom delete message
I currently use Devise for user registration/authentication in a Rails project. When a user wants to cancel their account, the user object is destroyed, which leaves my application in an undesired state.
What is the easiest way to implement a "soft delete", i.e. only removing personal data and marking the user as deleted? I still want to keep all record associations.
I assume I will have to first introduce a new "deleted" column for users. But then I am stuck with this default code in the user's profile view:
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
Where can I find the
:delete method? How should I overwrite the default Devise methods?