forked from saurabh/orbit4-5
29 lines
696 B
Ruby
29 lines
696 B
Ruby
class MemberProfile
|
|
include Mongoid::Document
|
|
include Mongoid::Timestamps
|
|
|
|
field :first_name, type: String, localize: true
|
|
field :last_name, type: String, localize: true
|
|
field :gender
|
|
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
|
|
paginates_per 10
|
|
|
|
def name
|
|
"#{self.first_name} #{self.last_name}"
|
|
end
|
|
end
|