23 lines
532 B
Ruby
23 lines
532 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ConversationsController < ApplicationController
|
|
def index
|
|
@conversations = @current_user.conversations
|
|
end
|
|
|
|
def show
|
|
@conversation = @current_user.conversations.find(params[:id])
|
|
@messages = @conversation.messages
|
|
@prompt = Message.new(conversation: @conversation)
|
|
end
|
|
|
|
def create
|
|
@conversation = @current_user.conversations.new
|
|
if @conversation.save
|
|
redirect_to @conversation
|
|
else
|
|
render :index, status: :unprocessable_entity
|
|
end
|
|
end
|
|
end
|