1class User < ActiveRecord::Base |
|
2 has_and_belongs_to_many :projects |
|
3 has_and_belongs_to_many :missions |
|
5 has_many :notes |
|
7 has_secure_password # password_confirmpasswordpassword |
|
9 validates :name, presence: true, length: { maximum: 30 } |
|
10 validates :email, presence: true, uniqueness: true, length: { maximum: 50}, |
|
11 format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i } |
|
12 validates :password, length: { minimum: 6 },on:create |
|
13 validates :phone, presence: true, format: { with: /\A[0-9]{11,11}\Z/i }, |
|
14 multiline: false |
|
15end |