uses comment strong parameters

This commit is contained in:
rgarcia
2015-08-16 23:04:26 +02:00
parent 7a53b000c9
commit efa0cf16d9

View File

@@ -24,11 +24,11 @@ class CommentsController < ApplicationController
private private
def comment_params def comment_params
params.require(:comments).permit(:commentable_type, :commentable_id, :body) params.require(:comment).permit(:commentable_type, :commentable_id, :body)
end end
def build_comment def build_comment
@comment = Comment.build(debate, current_user, params[:comment][:body]) @comment = Comment.build(debate, current_user, comment_params[:body])
end end
def debate def debate
@@ -36,7 +36,7 @@ class CommentsController < ApplicationController
end end
def parent def parent
@parent ||= Comment.find_parent(params[:comment]) @parent ||= Comment.find_parent(comment_params)
end end
def reply? def reply?