Module: ChatService

Extended by:
ChatService
Included in:
ChatService
Defined in:
lib/templates/chat/chat_service.rb

Instance Method Summary collapse

Instance Method Details

#create_message(chat, content, user) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/templates/chat/chat_service.rb', line 3

def create_message(chat, content, user)
  message = user.messages.create!(chat: chat, content: content)
  chat.messages << message
  chat.save!
  broadcast_message(chat, message)
  message
end