Sha256: d66152835561c5c71cd226b2efec1a5a889862c5f16d081abd7e5015fa7e113d

Contents?: true

Size: 901 Bytes

Versions: 5

Compression:

Stored size: 901 Bytes

Contents

# frozen_string_literal: true

class User < ApplicationRecord
  include PasswordCreatable

  # Scopes
  scope :active, -> { where(is_active: true) }

  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable,
         :registerable,
         :recoverable,
         :rememberable,
         :trackable,
         :validatable

  # Send devise emails with background job
  def send_devise_notification(notification, *args)
    devise_mailer.send(notification, self, *args).deliver_later
  end

  # Helpers
  audited except: [:password]

  # Validations
  validates_presence_of :name, :email, :surname
  validates :email, uniqueness: true

  def active_for_authentication?
    super && is_active
  end

  def full_name
    "#{name} #{surname}"
  end

  private

  def login_info_mailer
    UserMailer
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cybele-2.3.2 templates/app_files/app/models/user.rb
cybele-2.3.1 templates/app_files/app/models/user.rb
cybele-2.2.0 templates/app_files/app/models/user.rb
cybele-2.1.0 templates/app_files/app/models/user.rb
cybele-2.0.0 templates/app_files/app/models/user.rb