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
- #build_chat ⇒ Object
- #chat ⇒ Object
-
#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.
- #create_chat ⇒ Object
Instance Method Details
#build_chat ⇒ Object
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 |
#chat ⇒ Object
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_chat ⇒ Object
34 35 36 |
# File 'app/models/concerns/effective_messaging_parent.rb', line 34 def create_chat build_chat.tap { |chat| chat.save! } end |