Sha256: 4c22e51e2a04cb733553405218ff6a9743868a3043d249f4a16dde331fdff891

Contents?: true

Size: 475 Bytes

Versions: 7

Compression:

Stored size: 475 Bytes

Contents

module PandaCms
  class User < ApplicationRecord
    validates :firstname, presence: true
    validates :lastname, presence: true
    validates :email, presence: true, uniqueness: {case_sensitive: true}

    def is_admin?
      admin
    end

    def name
      "#{firstname} #{lastname}"
    end

    def self.for_select_list(scope = :all, order = {firstname: :asc, lastname: :asc})
      PandaCms::User.send(scope).order(order).map { |u| [u.name, u.id] }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
panda_cms-0.5.10 app/models/panda_cms/user.rb
panda_cms-0.5.9 app/models/panda_cms/user.rb
panda_cms-0.5.8 app/models/panda_cms/user.rb
panda_cms-0.5.7 app/models/panda_cms/user.rb
panda_cms-0.5.6 app/models/panda_cms/user.rb
panda_cms-0.5.5 app/models/panda_cms/user.rb
panda_cms-0.5.4 app/models/panda_cms/user.rb