docbrown/app/controllers/api/v0/comments_controller.rb
2018-02-28 16:11:08 -05:00

27 lines
677 B
Ruby

module Api
module V0
class CommentsController < ApplicationController
# before_action :set_cache_control_headers, only: [:index, :show]
caches_action :index,
:cache_path => Proc.new { |c| c.params.permit! },
:expires_in => 10.minutes
respond_to :json
caches_action :show,
:cache_path => Proc.new { |c| c.params.permit! },
:expires_in => 10.minutes
respond_to :json
def index
@commentable = Article.find(params[:a_id])# or not_found
@commentable_type = "Article"
end
def show
@comment = Comment.find(params[:id].to_i(26)) or not_found
end
end
end
end