Sha256: 34b4ddff9b05e3d075d0bb02bf679287069fd65ad461361d9908c2a9a84452f7
Contents?: true
Size: 888 Bytes
Versions: 5
Compression:
Stored size: 888 Bytes
Contents
class Wco::Profile include Mongoid::Document include Mongoid::Timestamps include Mongoid::Paranoia store_in collection: 'ish_user_profiles' field :email index({ email: 1 }, { name: 'email' }) validates :email, presence: true, uniqueness: true field :per_page, type: :integer, default: 25 field :show_n_thumbs, type: :integer, default: 8 belongs_to :leadset, class_name: 'Wco::Leadset', inverse_of: :profile, optional: true has_many :newsitems, class_name: 'Wco::Newsitem' has_and_belongs_to_many :shared_galleries, class_name: 'Wco::Gallery', inverse_of: :shared_profiles ROLE_ADMIN = 'admin' ROLE_GUY = 'guy' ROLES = [ ROLE_ADMIN, ROLE_GUY ] field :role, type: :string, default: ROLE_GUY def self.roles_list [nil] + ROLES end def to_s email end def self.list all.map { |p| [ p.email, p.id ] } end end
Version data entries
5 entries across 5 versions & 1 rubygems