47 lines
983 B
Ruby
47 lines
983 B
Ruby
|
# encoding: utf-8
|
||
|
|
||
|
class EmailErCategory
|
||
|
include Mongoid::Document
|
||
|
include Mongoid::Timestamps
|
||
|
include OrbitCoreLib::ObjectAuthable
|
||
|
include OrbitCoreLib::ObjectDisable
|
||
|
# include Sunspot::Mongo
|
||
|
# include Mongoid::MultiParameterAttributes
|
||
|
APP_NAME = 'ErEmail'
|
||
|
ObjectAuthTitlesOptions = %W{submit_new fact_check}
|
||
|
AfterObjectAuthUrl = '/panel/er_email/back_end/email_er_categorys'
|
||
|
|
||
|
field :disable, type: Boolean, :default => false
|
||
|
field :display
|
||
|
field :key
|
||
|
field :title, localize: true
|
||
|
|
||
|
has_many :email_ers
|
||
|
|
||
|
validates :title, :at_least_one => true
|
||
|
|
||
|
# searchable do
|
||
|
# text :titles do
|
||
|
# title_translations.to_a.collect{|t| t[1]}
|
||
|
# end
|
||
|
|
||
|
# boolean :frontend_search do
|
||
|
# !disable
|
||
|
# end
|
||
|
|
||
|
# text :files do
|
||
|
# email_ers.can_display.collect{|t| t.title_translations.to_a.collect{|t| t[1]}}
|
||
|
# end
|
||
|
|
||
|
# end
|
||
|
|
||
|
|
||
|
def pp_object
|
||
|
title
|
||
|
end
|
||
|
|
||
|
def self.from_id(id)
|
||
|
EmailErCategory.find(id) rescue nil
|
||
|
end
|
||
|
|
||
|
end
|