Created
June 6, 2018 15:49
-
-
Save obliviusm/6155ceae569a4d7ccae8100afcbb663b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # app/controllers/messages_controller.rb | |
| class MessagesController < ApplicationController | |
| respond_to :html, :json | |
| def new | |
| @message = Message.new | |
| respond_modal_with @message | |
| end | |
| def create | |
| @message = Message.create(message_params) | |
| respond_modal_with @message, location: messages_path | |
| end | |
| private | |
| def set_message | |
| @message = Message.find(params[:id]) | |
| end | |
| def message_params | |
| params.require(:message).permit(:name, :body) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment