orbit-announcement/app/models/bulletin_category.rb

34 lines
718 B
Ruby

# encoding: utf-8
class BulletinCategory
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCoreLib::ObjectAuthable
include OrbitCoreLib::ObjectDisable
ObjectAuthTitlesOptions = %W{submit_new fact_check}
AfterObjectAuthUrl = '/panel/announcement/back_end/bulletin_categorys'
# include Mongoid::MultiParameterAttributes
PAYMENT_TYPES = [ "List", "Picture" ]
APP_NAME = 'Announcement'
field :disable, type: Boolean, :default => false
field :display
field :key
field :title, localize: true
has_many :bulletins
validates :title, :at_least_one => true
def pp_object
title
end
def self.from_id(id)
BulletinCategory.find(id) rescue nil
end
end