diff --git a/app/models/message.rb b/app/models/message.rb index 20b9a756d..aa4bb2f55 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -421,6 +421,8 @@ class Message < ApplicationRecord end def reindex_for_search + return unless respond_to?(:reindex) + reindex(mode: :async) end end diff --git a/spec/models/contact_inbox_spec.rb b/spec/models/contact_inbox_spec.rb index c0a2faf9e..e63dede76 100644 --- a/spec/models/contact_inbox_spec.rb +++ b/spec/models/contact_inbox_spec.rb @@ -28,8 +28,7 @@ RSpec.describe ContactInbox do obj.reload # ensure the column is nil in database - results = ActiveRecord::Base.connection.execute('Select * from contact_inboxes;') - expect(results.first['pubsub_token']).to be_nil + expect(ContactInbox.where(id: obj.id).pick(:pubsub_token)).to be_nil new_token = obj.pubsub_token obj.update(source_id: '234234323')