Files
astuto/app/controllers/comments_controller.rb
2019-09-16 18:02:52 +02:00

12 lines
293 B
Ruby

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