docbrown/app/controllers/api/v0/comments_controller.rb
2019-09-09 14:51:02 -04:00

24 lines
631 B
Ruby

module Api
module V0
class CommentsController < ApiController
caches_action :index,
cache_path: proc { |c| c.params.permit! },
expires_in: 10.minutes
respond_to :json
caches_action :show,
cache_path: proc { |c| c.params.permit! },
expires_in: 10.minutes
respond_to :json
def index
article = Article.find(params[:a_id])
@comments = Comment.rooted_on(article, "Article").order(score: :desc)
end
def show
@comment = Comment.find(params[:id].to_i(26))
end
end
end
end