Skip to content

Instantly share code, notes, and snippets.

@dbridges
Last active March 16, 2018 05:05
Show Gist options
  • Save dbridges/fd6f4fdfe92632b64d4c82d0b7f89d99 to your computer and use it in GitHub Desktop.
Save dbridges/fd6f4fdfe92632b64d4c82d0b7f89d99 to your computer and use it in GitHub Desktop.
Rails UJS and Stimulus Comment List
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