2014-05-01 07:14:16 +00:00
|
|
|
class MemberProfile
|
|
|
|
include Mongoid::Document
|
2014-05-26 01:45:46 +00:00
|
|
|
include Mongoid::Timestamps
|
|
|
|
|
2014-05-01 07:14:16 +00:00
|
|
|
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
|
2014-05-26 01:45:46 +00:00
|
|
|
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 }
|
2014-05-01 07:14:16 +00:00
|
|
|
|
|
|
|
has_one :user
|
|
|
|
has_and_belongs_to_many :roles
|
|
|
|
|
|
|
|
mount_uploader :avatar, AvatarUploader
|
2014-05-09 06:03:55 +00:00
|
|
|
paginates_per 10
|
2014-05-01 07:14:16 +00:00
|
|
|
|
|
|
|
def name
|
|
|
|
"#{self.first_name} #{self.last_name}"
|
|
|
|
end
|
|
|
|
end
|