orbit4-5/app/models/member_profile.rb

29 lines
696 B
Ruby
Raw Normal View History

class MemberProfile
include Mongoid::Document
include Mongoid::Timestamps
field :first_name, type: String, localize: true
field :last_name, type: String, localize: true
field :gender
2014-05-09 06:03:55 +00:00
field :sid
field :office_tel
field :birthday, type: DateTime
field :address
field :personal_website
field :autobiography, type: String, localize: true
field :email, type: String
VALID_EMAIL_FORMAT = /\A[^@\s]+@([^@.\s]+\.)+[^@.\s]+\z/
validates :email, uniqueness: true, format: { with: VALID_EMAIL_FORMAT }
has_one :user
has_and_belongs_to_many :roles
mount_uploader :avatar, AvatarUploader
2014-05-09 06:03:55 +00:00
paginates_per 10
def name
"#{self.first_name} #{self.last_name}"
end
end