Module: Chats::ChatSubject

Extended by:
ActiveSupport::Concern
Defined in:
lib/chats/models/concerns/chat_subject.rb

Overview

Included by ‘acts_as_chat_subject`. Lets conversations be about a host record — `user.chat_with(driver, about: ride)` — which both threads the right people into the right context and shows up as a context line in the inbox/thread UI.

Override chat_subject_label to control that context line:

class Ride::Listing < ApplicationRecord
  acts_as_chat_subject
  def chat_subject_label = "#{origin_locality}#{destination_locality}"
end

Instance Method Summary collapse

Instance Method Details

#chat_subject_labelObject

Short human label shown as the conversation’s context line.



31
32
33
# File 'lib/chats/models/concerns/chat_subject.rb', line 31

def chat_subject_label
  "#{self.class.model_name.human} #{id}"
end