Sha256: 45491c955fa9502c9ac48afeb13e809a21d49ece483c1bfa0fdefddcfaaad203

Contents?: true

Size: 664 Bytes

Versions: 80

Compression:

Stored size: 664 Bytes

Contents

module Spree
  module Api
    module V1
      class CustomerReturnsController < Spree::Api::BaseController
        def index
          collection(Spree::CustomerReturn)
          respond_with(@collection)
        end

        private

        def collection(resource)
          return @collection if @collection.present?

          params[:q] ||= {}

          @collection = resource.all
          # @search needs to be defined as this is passed to search_form_for
          @search = @collection.ransack(params[:q])
          @collection = @search.result.order(created_at: :desc).page(params[:page]).per(params[:per_page])
        end
      end
    end
  end
end

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
spree_api-4.0.9 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.1.15 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.2.7 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.3.3 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.4.1 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.2.6 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.3.2 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.4.0 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.4.0.rc2 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.3.1 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.4.0.rc1 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.3.0 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.3.0.rc3 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.3.0.rc2 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.3.0.rc1 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.2.5 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.1.14 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.0.8 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-4.2.4 app/controllers/spree/api/v1/customer_returns_controller.rb
spree_api-3.7.14.1 app/controllers/spree/api/v1/customer_returns_controller.rb