class MemberInfo
  include Mongoid::Document
  include Mongoid::Timestamps

  field :key, type: String
  field :built_in, type: Boolean, default: false
  field :disabled, type: Boolean, default: false
  field :title, localize: true  
  
  field :to_search, type: Boolean, default: false
  field :to_show, type: Boolean, default: true

  has_many :member_profile_fields, autosave: true, dependent: :destroy
  accepts_nested_attributes_for :member_profile_fields, allow_destroy: true
  
  
  def is_built_in?
    self.built_in
  end
  
  def is_disabled?
    self.disabled
  end
  
  def get_enabled_attribute_fields
    self.member_profile_fields.excludes('disabled' => true)
  end
end