Class: Spree::Billing::OptionTypesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/billing/option_types_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#collection_url, #current_vendor, #default_url_options, #edit_object_url, #handle_unauthorized_vendor, #page, #per_page, #required_vendor_user!, #set_locale, #switch_vendor, #vendors

Methods included from SpreeCmCommissioner::Billing::RoleAuthorization

#auth_action, #auth_entry, #auth_user, #authorize!, #authorize?, #authorize_admin, #authorize_role!, #redirect_unauthorized_access

Instance Method Details

#update_values_positionsObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/spree/billing/option_types_controller.rb', line 6

def update_values_positions
  ApplicationRecord.transaction do
    params[:positions].each do |id, index|
      Spree::OptionValue.where(id: id).update_all(position: index) # rubocop:disable Rails/SkipsModelValidations
    end
  end

  respond_to do |format|
    format.html { redirect_to spree.admin_product_variants_url(params[:product_id]) }
    format.js { render plain: 'Ok' }
  end
end