Module: SolidusPagy::Admin::StockMovementsControllerDecorator

Defined in:
app/decorators/controllers/solidus_pagy/admin/stock_movements_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
# File 'app/decorators/controllers/solidus_pagy/admin/stock_movements_controller_decorator.rb', line 6

def self.prepended(base)
  base.class_eval do
    def index
      params[:q] ||= {}

      @search = collection.ransack(params[:q])
      @result = pagy(
        @search.result,
        page: params[:page]
      )
      @pagy = @result.first
      @stock_movements = @result.second
    end
  end
end