Sha256: f963394db3c7a4706e928623d7c69e641513742e96beb300e2be43d11dc20500
Contents?: true
Size: 1.16 KB
Versions: 6
Compression:
Stored size: 1.16 KB
Contents
class Wco::Tag include Mongoid::Document include Mongoid::Timestamps include Mongoid::Paranoia store_in collection: 'wco_tags' field :slug validates :slug, presence: true, uniqueness: true index({ slug: -1 }) # parent-child has_many :email_filters, class_name: 'WcoEmail::EmailFilter', inverse_of: :tag has_and_belongs_to_many :conversations, class_name: 'WcoEmail::Conversation', index: true has_and_belongs_to_many :message_stubs, class_name: 'WcoEmail::MessageStub' has_and_belongs_to_many :headlines # , class_name: 'Headline' has_and_belongs_to_many :leads, index: true # , class_name: 'Lead' has_and_belongs_to_many :leadsets # , class_name: 'Leadset' has_and_belongs_to_many :galleries has_and_belongs_to_many :reports has_and_belongs_to_many :videos has_and_belongs_to_many :logs INBOX = 'inbox' def self.inbox find_or_create_by({ slug: INBOX }) end TRASH = 'trash' def self.trash find_or_create_by({ slug: TRASH }) end SPAM = 'spam' def self.spam find_or_create_by({ slug: SPAM }) end def to_s slug end def self.list [[nil,nil]] + all.map { |p| [ p.slug, p.id ] } end end
Version data entries
6 entries across 6 versions & 1 rubygems