Ruby on rails, deactivation of a user

Alina

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?

palkan

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.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

In which file the current user is set in ruby on rails?

분류에서Dev

UsersController # create의 SyntaxError-@ user.save Ruby on Rails

분류에서Dev

Ruby on Rails 튜토리얼 7.21 장, params [: user]

분류에서Dev

To @ or not to @ in Ruby on Rails

분류에서Dev

@ user.save 인 경우 Ruby on Rails 가입 오류

분류에서Dev

Ruby on Rails 소수?

분류에서Dev

ActiveModel :: ForbiddenAttributesError Ruby On Rails

분류에서Dev

Ruby on Rails Fields For Issue

분류에서Dev

Ruby on rails unitialized constant

분류에서Dev

Each loop in Ruby on Rails

분류에서Dev

Ruby on Rails String Concatenation

분류에서Dev

Defining Ruby on Rails Relationship

분류에서Dev

Ruby on Rails 및 Ajax

분류에서Dev

Ruby on Rails 계산

분류에서Dev

Ruby on Rails 및 Twilio

분류에서Dev

Ruby on Rails Routing Error

분류에서Dev

Ruby on Rails : ActiveRecord :: AssociationTypeMismatch

분류에서Dev

Ticketee Ruby on Rails 4

분류에서Dev

Ruby on Rails CanCan Gem

분류에서Dev

Ruby on Rails의 User.new에 대한 설명? (Michael Hartl의 튜토리얼에서)

분류에서Dev

Ruby on Rails 세션 [: user_id]이 제대로 설정되지 않았습니다.

분류에서Dev

Ruby on Rails : # <ActiveRecord :: Relation :: ActiveRecord_Relation_User : 0x4451148>에 대한 정의되지 않은 메소드`user '

분류에서Dev

Ruby on Rails - Ruby Operator Precedence - Parentheses

분류에서Dev

Cant install ruby-switch for ruby on rails

분류에서Dev

Ruby on Rails 구문 <% vs <% =

분류에서Dev

Ruby on Rails .erb 파일

분류에서Dev

Ruby on Rails will_paginate-NoMethodError

분류에서Dev

Ruby On Rails Rspec require conflicts

분류에서Dev

Ruby on Rails each method and divs