Sha256: 7e2bf4563b7afbdf695c0c40c1be1c3b32a2e8c3c694a89817e0b9f2178bad78

Contents?: true

Size: 521 Bytes

Versions: 37

Compression:

Stored size: 521 Bytes

Contents

module Spree
  module Api
    class ClassificationsController < Spree::Api::BaseController
      def update
        authorize! :update, Product
        authorize! :update, Taxon
        classification = Spree::Classification.find_by(
          product_id: params[:product_id],
          taxon_id: params[:taxon_id]
        )
        # Because position we get back is 0-indexed.
        # acts_as_list is 1-indexed.
        classification.insert_at(params[:position].to_i + 1)
        head :ok
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
solidus_api-2.5.2 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.5.1 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.5.0 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.5.0.rc1 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.5.0.beta2 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.5.0.beta1 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.4.2 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.4.1 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.3.1 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.2.2 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.1.1 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.0.3 app/controllers/spree/api/classifications_controller.rb
solidus_api-1.4.2 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.4.0 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.4.0.rc1 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.4.0.beta1 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.3.0 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.3.0.rc3 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.3.0.rc2 app/controllers/spree/api/classifications_controller.rb
solidus_api-2.3.0.rc1 app/controllers/spree/api/classifications_controller.rb