Sha256: 21eee04be2ecd067c60d153000e69303b33b2530a8bff374e14a317b01c84faa

Contents?: true

Size: 1.13 KB

Versions: 24

Compression:

Stored size: 1.13 KB

Contents

class WcoEmail::Conversation
  include Mongoid::Document
  include Mongoid::Timestamps
  # include Mongoid::Paranoia

  store_in collection: 'office_email_conversations'

  STATE_UNREAD = 'state_unread'
  STATE_READ   = 'state_read'
  STATES       = [ STATE_UNREAD, STATE_READ ]
  field :state

  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 :lead_ties, class_name: 'Office::EmailConversationLead'
  # def lead_ids
  #   email_conversation_leads.map( &:lead_id )
  # end
  # field :lead_ids, type: :array, default: []
  # def leads
  #   Lead.find( lead_ties.map( &:lead_id ) )
  # end

  # has_many :email_messages,          class_name: 'Office::EmailMessage'
  # has_many :email_conversation_tags, class_name: 'Office::EmailConversationTag'

  has_and_belongs_to_many :tags, class_name: 'Wco::Tag'

  # def self.in_tag tag
  #   case tag.class
  #   when String
  #     tag = Wco::Tag.find_by slug: tag
  #   end
  #   where( :tag_ids => tag.id )
  # end

end
Conv = WcoEmail::Conversation

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
wco_models-3.1.0.37 app/models/wco_email/conversation.rb
wco_models-3.1.0.36 app/models/wco_email/conversation.rb
wco_models-3.1.0.35 app/models/wco_email/conversation.rb
wco_models-3.1.0.34 app/models/wco_email/conversation.rb
wco_models-3.1.0.33 app/models/wco_email/conversation.rb
wco_models-3.1.0.32 app/models/wco_email/conversation.rb
wco_models-3.1.0.31 app/models/wco_email/conversation.rb
ish_models-3.1.0.29 app/models/wco_email/conversation.rb
ish_models-3.1.0.28 app/models/wco_email/conversation.rb
ish_models-3.1.0.27 app/models/wco_email/conversation.rb
ish_models-3.1.0.26 app/models/wco_email/conversation.rb
ish_models-3.1.0.25 app/models/wco_email/conversation.rb
ish_models-3.1.0.24 app/models/wco_email/conversation.rb
ish_models-3.1.0.23 app/models/wco_email/conversation.rb
ish_models-3.1.0.22 app/models/wco_email/conversation.rb
ish_models-3.1.0.21 app/models/wco_email/conversation.rb
ish_models-3.1.0.20 app/models/wco_email/conversation.rb
ish_models-3.1.0.19 app/models/wco_email/conversation.rb
ish_models-3.1.0.18 app/models/wco_email/conversation.rb
ish_models-3.1.0.17 app/models/wco_email/conversation.rb