user.rb 450 B

12345678910111213
  1. class User < ApplicationRecord
  2. has_many :notifications, foreign_key: :recipient_id
  3. # Include default devise modules. Others available are:
  4. # :confirmable, :lockable, :timeoutable and :omniauthable
  5. devise :masqueradable, :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable
  6. validates :first_name, :last_name, presence: true
  7. def name
  8. "#{first_name} #{last_name}"
  9. end
  10. end