summaryrefslogtreecommitdiff
path: root/app/controllers/api/v3/posts/comments_controller.rb
blob: 176292918667ec3121d9527ae883e610187c618c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true
class Api::V3::Posts::CommentsController < Api::V3::ApiController
  include BetterRateLimitable

  before_action -> { rate_limit 60, 1.minute, 'You are submitting too many API requests!' }

  def index
    post = Post.find(params[:post_id])
    authorize! :read, post

    render json: { comments: CommentSerializer.serialize_collection(post.comments.to_a) }
  end
end