* Initial automatic cleanup with rubocop * Fix syntax error introduced by rubocop * Cleanup seeds file * Cleanup lib folder * Exclude bin folder because it contains auto generated files * Make Rubocop a little bit more chatty * Block length should not include comments in the count * Cleanup config folder * Cleanup specs * Updated Rubocop version and generated a todo file * Fix broken ArticlesApi spec * Fix tests * Restored rubocop pre-commit hook
25 lines
666 B
Ruby
25 lines
666 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))) || not_found
|
|
end
|
|
end
|
|
end
|
|
end
|