Last active
March 16, 2018 05:05
-
-
Save dbridges/fd6f4fdfe92632b64d4c82d0b7f89d99 to your computer and use it in GitHub Desktop.
Rails UJS and Stimulus Comment List
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
class CommentsController < ApplicationController | |
def index | |
@comments = Comment.all | |
end | |
def create | |
@comment = current_user.comments.create(comment_params) | |
render @comment | |
end | |
private | |
def comment_params | |
params.require(:comment).permit(:message) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment