Sha256: d98afe32e2c124eb8677a61d1a71d7d00f41c9c485cfa22b5e64282aa5d0692f

Contents?: true

Size: 857 Bytes

Versions: 3

Compression:

Stored size: 857 Bytes

Contents

# frozen_string_literal: true

module SolidusAdmin
  class TaxRatesController < SolidusAdmin::BaseController
    include SolidusAdmin::ControllerHelpers::Search

    def index
      tax_rates = apply_search_to(
        Spree::TaxRate.order(created_at: :desc, id: :desc),
        param: :q,
      )

      set_page_and_extract_portion_from(tax_rates)

      respond_to do |format|
        format.html { render component('tax_rates/index').new(page: @page) }
      end
    end

    def destroy
      @tax_rates = Spree::TaxRate.where(id: params[:id])

      Spree::TaxRate.transaction { @tax_rates.destroy_all }

      flash[:notice] = t('.success')
      redirect_back_or_to tax_rates_path, status: :see_other
    end

    private

    def tax_rate_params
      params.require(:tax_rate).permit(:tax_rate_id, permitted_tax_rate_attributes)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_admin-0.3.2 app/controllers/solidus_admin/tax_rates_controller.rb
solidus_admin-0.3.1 app/controllers/solidus_admin/tax_rates_controller.rb
solidus_admin-0.3.0 app/controllers/solidus_admin/tax_rates_controller.rb