Sha256: 35023e1ad8eaa3499d32592ff17409a7ae44b407d896c78102b5130f424c965e

Contents?: true

Size: 645 Bytes

Versions: 8

Compression:

Stored size: 645 Bytes

Contents

module Spree
  module Api
    module V2
      class ChildrenController < Spree::Api::V2::BaseController
        skip_before_action :authenticate_user, only: [:index, :show]

        def index
          render_collection children.includes(:products, :taxonomy, :children, :parent)
        end

        def show
          render_instance children.find(params[:id])
        end

        private

        def children
          if params[:taxon_id]
            Spree::Taxon.find(params[:taxon_id])
          end.children
        end

        def filter_attributes
          Spree::TaxonSerializer._attributes
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
solidus_json_api-0.3.1 app/controllers/spree/api/v2/children_controller.rb
solidus_json_api-0.3.0 app/controllers/spree/api/v2/children_controller.rb
spree_api_v2-0.2.2 app/controllers/spree/api/v2/children_controller.rb
solidus_api_v2-0.2.2 app/controllers/spree/api/v2/children_controller.rb
solidus_api_v2-0.2.1 app/controllers/spree/api/v2/children_controller.rb
spree_api_v2-0.2.1 app/controllers/spree/api/v2/children_controller.rb
spree_api_v2-0.2.0 app/controllers/spree/api/v2/children_controller.rb
solidus_api_v2-0.2.0 app/controllers/spree/api/v2/children_controller.rb