Devise Deactivatable
Deactivatable Support for Devise
Usage
Add it to your Gemfile
gem "devise_deactivatable"
Add the deactivatable
module to your model:
class User < ActiveRecord::Base
devise :database_authenticatable, :deactivatable
end
And add the deactivated_at
field to the database through a migration:
class DeviseCreateUsers < ActiveRecord::Migration
def change
add_column :users, :deactivated_at, :datetime
end
end
Model
Deactivate
u.deactivated?
u.deactivate!
Scope
# scope
User.deactivated
Customerize after_deactivate
class User
def after_deactivate
# do something
end
end
Controller
You can send post request to '/users/deactivate' to deactivate the user. You can also customize the controller.
Contributing
- Fork it
- Write your changes
- Commit
- Send a pull request
License
Apache License version 2.