Sha256: 9e5544a9bcd0859ffea174f4f4eaaab78c9c4f7c9266b245f6aced9a8680c6b9

Contents?: true

Size: 346 Bytes

Versions: 1

Compression:

Stored size: 346 Bytes

Contents

# frozen_string_literal: true

class Tramway::User < Tramway::ApplicationRecord
  has_secure_password

  scope :admins, -> { where role: :admin }
  scope :simple_users, -> { where role: :user }

  enumerize :role, in: %i[user admin], default: :admin

  def admin?
    role.admin?
  end

  def full_name
    "#{first_name} #{last_name}"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tramway-0.1.2 app/models/tramway/user.rb