Alina
Alina

Reputation: 2261

Ruby on rails, deactivation of a user

I am using sorcery gem for user authentication. My model is:

 create_table "users", :force => true do |t|
    t.string   "email",                                                          :null => false
    t.string   "crypted_password"
    t.string   "salt"
    t.datetime "created_at",                                                     :null => false
    t.datetime "updated_at",                                                     :null => false
    t.string   "remember_me_token"
    t.datetime "remember_me_token_expires_at"
    t.string   "activation_state"
    t.string   "activation_token"
    t.datetime "activation_token_expires_at"
 end

I could not find in the internet if there is a built-in function for deactivating a user. Will it be safe to find a user and just change the parameter activation_state to inactive?

Upvotes: 0

Views: 318

Answers (1)

palkan
palkan

Reputation: 191

You can call

user.setup_activation

it will set activation_state to 'pending' and create new activation_token.

Or you can set activation_state to 'pending' manually. That's all.

Upvotes: 1

Related Questions