Class: Conversations::MessagesController

Inherits:
ApplicationController
  • Object
show all
Includes:
ApplicationHelper
Defined in:
app/controllers/conversations/messages_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/conversations/messages_controller.rb', line 5

def create
  @user = User.find(params[:user_id])
  @conversation = UserConversation.find params[:conversation_id]
  @message = @conversation.conversation.messages.build params[:conversations_message]
  @message.user = @user
  if @message.save
    redirect_to user_conversation_path(@user, @conversation)
  else
    render template: 'conversations/user_conversations/show'
  end
end