Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment