Skip to content

Commit

Permalink
fix: comments controller to add new comments with user id
Browse files Browse the repository at this point in the history
  • Loading branch information
demesameneshoa committed Dec 15, 2023
1 parent 6f24d07 commit fbf495f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/comments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def create
@user = User.find(params[:user_id])
@post = @user.posts.find(params[:post_id])
@comment = @post.comments.build(comment_params)
@comment.user = @user
@comment.user_id = @user.id

if @comment.save
render json: @comment, status: :created, location: api_v1_user_post_comment_url(@user, @post, @comment)
Expand Down

0 comments on commit fbf495f

Please sign in to comment.