Sha256: bb3f24836bde44b872acb99d67edc94dcac5c40e6102cbddafd83ba3b93b0de6
Contents?: true
Size: 1003 Bytes
Versions: 41
Compression:
Stored size: 1003 Bytes
Contents
class WcoEmail::Conversation include Mongoid::Document include Mongoid::Timestamps include Mongoid::Paranoia store_in collection: 'office_email_conversations' STATUS_UNREAD = 'status_unread' STATUS_READ = 'status_read' STATUSES = [ STATUS_UNREAD, STATUS_READ ] field :status scope :unread, ->{ where( status: WcoEmail::Conversation::STATUS_UNREAD ) } def unread? status == STATUS_UNREAD end field :subject index({ subject: -1 }) field :latest_at index({ latest_at: -1 }) field :from_emails, type: :array, default: [] index({ from_emails: -1 }) field :preview, default: '' has_many :messages, class_name: '::WcoEmail::Message' has_and_belongs_to_many :tags, class_name: 'Wco::Tag' has_and_belongs_to_many :leads, class_name: 'Wco::Lead' belongs_to :filter, class_name: 'WcoEmail::EmailFilter', inverse_of: :conversations, optional: true def to_s "#{subject} (#{messages.length})" end end Conv = WcoEmail::Conversation
Version data entries
41 entries across 41 versions & 1 rubygems