Class: Envoy::ConversationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/envoy/conversations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/envoy/conversations_controller.rb', line 11

def create
  @conversation = Conversation.new(conversation_params)
  @conversation.actor = envoy_current_actor
  @conversation.model_id ||= Envoy.config.default_model
  @conversation.provider = Envoy.config.provider.to_s
  if @conversation.save
    redirect_to conversation_path(@conversation)
  else
    render :new, status: :unprocessable_entity
  end
end

#indexObject



3
4
5
# File 'app/controllers/envoy/conversations_controller.rb', line 3

def index
  @conversations = Conversation.where(actor: envoy_current_actor).order(created_at: :desc)
end

#newObject



7
8
9
# File 'app/controllers/envoy/conversations_controller.rb', line 7

def new
  @conversation = Conversation.new
end

#showObject



23
24
25
# File 'app/controllers/envoy/conversations_controller.rb', line 23

def show
  @conversation = Conversation.where(actor: envoy_current_actor).find(params[:id])
end