Class: MessagesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- MessagesController
- Defined in:
- lib/generators/appchat/templates/messages_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/appchat/templates/messages_controller.rb', line 8 def create @message = @chat..build() if @message.save GetAiResponseJob.perform_later(@message.chat_id, @message.content) redirect_to (chat_id: @chat.id), notice: 'Message was successfully created.' else render :new end end |
#index ⇒ Object
18 19 20 |
# File 'lib/generators/appchat/templates/messages_controller.rb', line 18 def index @messages = @chat. end |
#new ⇒ Object
4 5 6 |
# File 'lib/generators/appchat/templates/messages_controller.rb', line 4 def new @message = @chat..new end |