blob: 36c30126150b4f8e0ac785c68205963b6423aa56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
class CommentsController < ApplicationController
def create
creation = Creation.find(creation_id)
@comment = current_user.comment_on(creation, comment_params[:text], comment_params[:id])
render json: @comment
end
private
def creation_id
params[:url].match(/\/(\d+)/)[0].gsub("/", "")
end
def comment_params
params.require(:comment).permit(:id, :text)
end
end
|