6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/decorators/controllers/solidus_pagy/admin/products_controller_decorator.rb', line 6
def self.prepended(base)
base.class_eval do
private
def collection
return @collection if @collection
params[:q] ||= {}
params[:q][:s] ||= 'name asc'
@search = super.ransack(params[:q])
@result = pagy(
@search.result.order(id: :asc)
.includes(product_includes),
page: params[:page],
items: ::SolidusPagy.config.admin_products_per_page
)
@pagy = @result.first
@collection = @result.second
end
end
end
|