module Api class JurisprudencesController < BaseController include JurisprudenceSearch authorize_resource :jurisprudence, class: "Cdao::Jurisprudence", only: %i[index] def index search = jurisprudence_search(search_params) @jurisprudences = search.results respond_with @jurisprudences end def show respond_with @jurisprudence end def years authorize! :index, Cdao::Jurisprudence @years = (1901..Time.zone.today.year).entries.reverse respond_with @years end private def search_params params.permit(:reference_number, :title, :short_title, :q, :page, :per_page) end end end