app/controllers/comments_controller.rb in tkh_content-0.9.15 vs app/controllers/comments_controller.rb in tkh_content-0.9.16
- old
+ new
@@ -20,14 +20,14 @@
@comment = Comment.new(comment_params)
@comment.author_id = current_user.id
@comment.locale = I18n.locale.to_s
@comment.status = 'pending' # translation not done with globalize3 but with locale files upon showing status to user
if @comment.save
- redirect_to @comment.page, notice: t('comments.create.notice')
+ redirect_to @comment.commentable, notice: t('comments.create.notice')
else
flash[:warning] = t('comments.create.warning')
- redirect_to @comment.page
+ redirect_to @comment.commentable
end
end
def update
@comment = Comment.find(params[:id])
@@ -92,10 +92,10 @@
private
# Never trust parameters from the scary internet, only allow the white list through.
def comment_params
- params.require(:comment).permit(:body, :page_id)
+ params.require(:comment).permit(:body, :commentable_type, :commentable_id)
# non-accessible attributes: author_id, :status, :locale
end
end