From 45bdb85bf3c769ce055aaa262a2412f1d949f5da Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Wed, 14 Aug 2019 18:29:09 +0100 Subject: [PATCH] Add missing method and skip_authorization_check to taxons controller --- app/controllers/api/taxons_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/taxons_controller.rb b/app/controllers/api/taxons_controller.rb index c20097e0f6..e446e3c3fc 100644 --- a/app/controllers/api/taxons_controller.rb +++ b/app/controllers/api/taxons_controller.rb @@ -2,7 +2,7 @@ module Api class TaxonsController < Api::BaseController respond_to :json - skip_authorization_check only: :index + skip_authorization_check only: [:index, :show, :jstree] def index if taxonomy @@ -19,7 +19,7 @@ module Api def show @taxon = taxon - respond_with(@taxon) + render json: @taxon, serializer: Api::TaxonSerializer end def jstree @@ -32,5 +32,9 @@ module Api return if params[:taxonomy_id].blank? @taxonomy ||= Spree::Taxonomy.find(params[:taxonomy_id]) end + + def taxon + @taxon ||= taxonomy.taxons.find(params[:id]) + end end end