Use a state machine for user status
The user status is a bit complex, since there are various states and not all transitions between them make sense. Using AASM means that we can name and restrict the transitions, which hopefully makes them easier to reason about.
This commit is contained in:
parent
786f28993a
commit
1a11c4dc19
12 changed files with 103 additions and 45 deletions
|
@ -46,7 +46,7 @@ class PasswordsController < ApplicationController
|
|||
if params[:user]
|
||||
current_user.pass_crypt = params[:user][:pass_crypt]
|
||||
current_user.pass_crypt_confirmation = params[:user][:pass_crypt_confirmation]
|
||||
current_user.status = "active" if current_user.status == "pending"
|
||||
current_user.activate if current_user.may_activate?
|
||||
current_user.email_valid = true
|
||||
|
||||
if current_user.save
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue