Sha256: 79f2deec4c8f9c93fc530dc6225edeb21ca9d879b0a52d5985494513cb70eb06

Contents?: true

Size: 552 Bytes

Versions: 134

Compression:

Stored size: 552 Bytes

Contents

# frozen_string_literal: true

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

134 entries across 134 versions & 2 rubygems

Version Path
solidus_api-4.4.1 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.4.0 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.3.4 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.2.4 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.1.5 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.3.3 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.3.2 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.1.4 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.3.1 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.3.0 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.2.3 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.1.3 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.0.4 app/controllers/spree/api/classifications_controller.rb
solidus_api-3.4.6 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.0.3 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.1.2 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.2.2 app/controllers/spree/api/classifications_controller.rb
solidus_api-3.4.5 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.2.1 app/controllers/spree/api/classifications_controller.rb
solidus_api-4.2.0 app/controllers/spree/api/classifications_controller.rb