Class: Spree::Admin::FosdickShipmentsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/admin/fosdick_shipments_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/spree/admin/fosdick_shipments_controller.rb', line 4

def index
  params[:q] ||= {}

  params_clone = params[:q].deep_dup

  [:created_at_gt, :created_at_lt, :ship_date_gt, :ship_date_lt].each do |date_param|
    if params_clone[date_param].present?
      params_clone[date_param] = Time.zone.parse(params_clone[date_param]).beginning_of_day rescue ''
    end
  end

  @search = Spree::FosdickShipment.includes(:fosdick_exceptions).ransack(params_clone)
  @fosdick_shipments = @search.result(distinct: true).page(params[:page]).per(Spree::Config[:admin_products_per_page]).order(created_at: :desc)
end