diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 766995515..1b23c6839 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -1,2 +1,19 @@ class CommentsController < ApplicationController + before_action :set_splat + + def create + @comment = @splat.comments.create(comment_params) + @comment.save + + redirect_to splat_path(@splat) + end + + private + def comment_params + params.require(:comment).permit(:body) + end + + def set_splat + @splat = Splat.find(params[:splat_id]) + end end diff --git a/app/views/comments/_new.html.erb b/app/views/comments/_new.html.erb new file mode 100644 index 000000000..9e4b19819 --- /dev/null +++ b/app/views/comments/_new.html.erb @@ -0,0 +1,18 @@ +