Module: SolidusPagy::Admin::TaxRatesControllerDecorator

Defined in:
app/decorators/controllers/solidus_pagy/admin/tax_rates_controller_decorator.rb

Class Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/decorators/controllers/solidus_pagy/admin/tax_rates_controller_decorator.rb', line 6

def self.prepended(base)
  base.class_eval do
    private

    def collection
      @search = Spree::TaxRate.ransack(params[:q])
      @collection = @search.result
      @result = pagy(
        @collection.includes(:tax_categories).order(:zone_id),
        page: params[:page],
        items: ::SolidusPagy.config.admin_products_per_page
      )
      @pagy = @result.first
      @collection = @result.second
    end
  end
end