# encoding: utf-8

class WritingBookCategory
  include Mongoid::Document
  include Mongoid::Timestamps
  include OrbitCoreLib::ObjectAuthable
  include OrbitCoreLib::ObjectDisable
  # include Mongoid::MultiParameterAttributes
  AfterObjectAuthUrl = '/panel/personal_book/back_end/writing_book_categorys'
  APP_NAME = 'writing_book'
  # ObjectAuthTitlesOptions = %W{edit}
  ObjectAuthTitlesOptions = %W{submit_new fact_check}

  field :key
  
  has_many :writing_books
  
  def pp_object
    title
  end
  
  def self.from_id(id)
    WritingBookCategory.find(id) rescue nil
  end

  def self.is_localized?(field_name)
	self.fields[field_name.to_s].localized?
  end
  
end