mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 19:27:52 +01:00
Add comments controller and routes
This commit is contained in:
11
app/controllers/comments_controller.rb
Normal file
11
app/controllers/comments_controller.rb
Normal 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
|
||||
Reference in New Issue
Block a user