Sha256: 2db2e5ce6f626d1de569b51fbf1c311a7c2089820a86688a838bfdb069b5f21a

Contents?: true

Size: 730 Bytes

Versions: 10

Compression:

Stored size: 730 Bytes

Contents

class Cms::Fortress::User < ActiveRecord::Base
  # set_table_name :cms_fortress_users
  self.table_name = "cms_fortress_users"

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

  belongs_to :role
  belongs_to :site, class_name: "Comfy::Cms::Site", foreign_key: :site_id

  scope :all_super, -> { where(type_id: 1) }

  def self.types
    {
      1 => :super_user,
      2 => :site_user
    }
  end

  def type
    self.class.types[type_id]
  end

  def display_name
    "#{ email } (#{ type.to_s.titleize })"
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cms-fortress-1.3.6 app/models/cms/fortress/user.rb
cms-fortress-1.3.5 app/models/cms/fortress/user.rb
cms-fortress-1.3.4 app/models/cms/fortress/user.rb
cms-fortress-1.3.3 app/models/cms/fortress/user.rb
cms-fortress-1.3.2 app/models/cms/fortress/user.rb
cms-fortress-1.3.1 app/models/cms/fortress/user.rb
cms-fortress-1.3.0 app/models/cms/fortress/user.rb
cms-fortress-1.3.0.rc3 app/models/cms/fortress/user.rb
cms-fortress-1.3.0.rc2 app/models/cms/fortress/user.rb
cms-fortress-1.3.0.rc1 app/models/cms/fortress/user.rb