Add comments controller and routes

This commit is contained in:
riggraz
2019-09-16 18:02:52 +02:00
parent 3f4eba70d7
commit 3c6e27be14
7 changed files with 25 additions and 7 deletions

View File

@@ -0,0 +1,11 @@
class CommentsController < ApplicationController
def index
comments = Comment
.where(post_id: params[:post_id])
.left_outer_joins(:user)
.select('comments.body, comments.updated_at, users.full_name')
.order(updated_at: :desc)
render json: comments
end
end