Sha256: 9857da7ebe613784923555a0d0c59e8a76d80dd5ee588e886d9d442e830d243a

Contents?: true

Size: 707 Bytes

Versions: 5

Compression:

Stored size: 707 Bytes

Contents

require_dependency "mechanize_store/application_controller"

module MechanizeStore
    class OrdersController < ApplicationController
        respond_to :html, :json

        before_action :fetch_collections, only: [:index]

        def fetch_collections
            @order_statuses = OrderStatus.all
            @payment_statuses = PaymentStatus.all
        end

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

            @search = Order.search(params[:q])
            
            @orders = @search.result.paginate(page: params[:page])

            respond_with @orders
        end 

        def show
            @order = Order.find(params[:id])
            respond_with @order
        end 
    end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mechanize_store-0.0.8 app/controllers/mechanize_store/orders_controller.rb
mechanize_store-0.0.7 app/controllers/mechanize_store/orders_controller.rb
mechanize_store-0.0.6 app/controllers/mechanize_store/orders_controller.rb
mechanize_store-0.0.5 app/controllers/mechanize_store/orders_controller.rb
mechanize_store-0.0.4 app/controllers/mechanize_store/orders_controller.rb