2020-03-05 20:13:12 +00:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: agent_bot_inboxes
|
|
|
|
#
|
|
|
|
# id :bigint not null, primary key
|
|
|
|
# status :integer default("active")
|
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
2020-03-10 18:32:15 +00:00
|
|
|
# account_id :integer
|
2020-03-05 20:13:12 +00:00
|
|
|
# agent_bot_id :integer
|
|
|
|
# inbox_id :integer
|
|
|
|
#
|
|
|
|
|
|
|
|
class AgentBotInbox < ApplicationRecord
|
|
|
|
validates :inbox_id, presence: true
|
|
|
|
validates :agent_bot_id, presence: true
|
2020-03-10 18:32:15 +00:00
|
|
|
before_validation :ensure_account_id
|
2020-03-05 20:13:12 +00:00
|
|
|
|
|
|
|
belongs_to :inbox
|
|
|
|
belongs_to :agent_bot
|
2020-03-10 18:32:15 +00:00
|
|
|
belongs_to :account
|
2020-03-05 20:13:12 +00:00
|
|
|
enum status: { active: 0, inactive: 1 }
|
2020-03-10 18:32:15 +00:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def ensure_account_id
|
|
|
|
self.account_id = inbox&.account_id
|
|
|
|
end
|
2020-03-05 20:13:12 +00:00
|
|
|
end
|