Module: EffectiveMessagingParent

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/effective_messaging_parent.rb

Overview

Mostly for the callbacks

Defined Under Namespace

Modules: Base, ClassMethods

Instance Method Summary collapse

Instance Method Details

#build_chatObject



25
26
27
28
29
30
31
32
# File 'app/models/concerns/effective_messaging_parent.rb', line 25

def build_chat
  raise('to be implemented by parent')

  # chat = chats.first || chats.build()
  # chat_user = chat.build_chat_user(user: user)
  # reviewers.each { |reviewer| chat.build_chat_user(user: reviewer.user) }
  # chat
end

#chatObject



21
22
23
# File 'app/models/concerns/effective_messaging_parent.rb', line 21

def chat
  chats.first
end

#chat_url(chat:, user:, root_url:) ⇒ Object

Hook so the parent can specify the correct url for this user to visit to see the new chat message



39
40
41
# File 'app/models/concerns/effective_messaging_parent.rb', line 39

def chat_url(chat:, user:, root_url:)
  nil
end

#create_chatObject



34
35
36
# File 'app/models/concerns/effective_messaging_parent.rb', line 34

def create_chat
  build_chat.tap { |chat| chat.save! }
end