API de comptabilité horaire.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

user.rb 718B

123456789101112131415161718
  1. class User < ApplicationRecord
  2. validates :email, uniqueness: true, presence: true, :on => :create
  3. validates :username, uniqueness: true, presence: true, :on => :create
  4. validates :email, format:{ with: /\S+@\S+[.]\S+/, message: "Must be a valid email format." }
  5. validates :password_digest, presence: true
  6. has_many :created_activities, foreign_key: 'author_id', class_name: 'Activity', dependent: :destroy
  7. has_many :joined_user_activities
  8. has_many :activities, :through => :joined_user_activities
  9. has_many :tasks, foreign_key: 'owner_id', class_name: 'Task'
  10. has_many :memberships, foreign_key: :member_id, dependent: :destroy
  11. has_many :teams, through: :memberships
  12. has_secure_password
  13. end