Class: Raif::ConversationsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#raif_current_user

Instance Method Details

#showObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/raif/conversations_controller.rb', line 6

def show
  @conversations = conversations_scope

  @conversation = if params[:id] == "latest"
    if @conversations.any?
      @conversations.first
    else
      conversation = build_new_conversation
      conversation.save!
      conversation
    end
  else
    @conversations.find(params[:id])
  end
end