app/models/cms/fortress/user.rb in cms-fortress-1.2.2 vs app/models/cms/fortress/user.rb in cms-fortress-1.3.0.rc1

- old
+ new

@@ -7,7 +7,24 @@ # :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