user validation
This commit is contained in:
parent
39a89ad564
commit
ed6a5d69f6
7 changed files with 38 additions and 8 deletions
|
@ -1,4 +1,9 @@
|
|||
class User < ApplicationRecord
|
||||
has_secure_password
|
||||
has_secure_password :recovery_password, validations: false
|
||||
enum role: [:customer, :admin], _default: :customer
|
||||
|
||||
validates :email, presence: true, uniqueness: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
||||
validates :role, presence: true
|
||||
validates :password, presence: true, length: { minimum: 8 }
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue