12345678910111213 |
- class User < ApplicationRecord
- validates :email, uniqueness: true, presence: true, :on => :create
- validates :username, uniqueness: true, presence: true, :on => :create
- validates :email, format:{ with: /\S+@\S+[.]\S+/, message: "Must be a valid email format." }
- validates :password_digest, presence: true
-
- has_many :created_activities, foreign_key: 'author_id', class_name: 'Activity', dependent: :destroy
-
- has_many :joined_user_activities
- has_many :activities, :through => :joined_user_activities
-
- has_secure_password
- end
|