Chatwoot/app/models/contact.rb

22 lines
457 B
Ruby
Raw Normal View History

class Contact < ApplicationRecord
2019-10-16 22:18:48 +00:00
include Pubsubable
2019-10-20 08:47:26 +00:00
validates :account_id, presence: true
validates :inbox_id, presence: true
belongs_to :account
belongs_to :inbox
has_many :conversations, dependent: :destroy
mount_uploader :avatar, AvatarUploader
def push_event_data
{
id: id,
name: name,
thumbnail: avatar.thumb.url,
channel: inbox.try(:channel).try(:name),
pubsub_token: pubsub_token
}
end
end