app/controllers/orders_controller.rb
# GET /orders
# all my orders
GET /orders
all my orders
GET / orders all my orders
def index
    @order_details = session_user.order_details.item_and_service_orders
    @available_statuses = %w(pending all)
    case params[:status]
    when "pending"
      @order_details = @order_details.new_or_inprocess
    when "all"
      @order_details = @order_details.purchased
    else
      redirect_to orders_status_path(status: "pending")
      return
    end
    @order_details = @order_details. order("order_details.created_at DESC").paginate(page: params[:page])
  end
def index @order_details = session_user . order_details . item_and_service_orders @available_statuses = %w( pending all ) case params [ :status ] when "pending" @order_details = @order_details . new_or_inprocess when "all" @order_details = @order_details . purchased else redirect_to orders_status_path ( status : "pending" ) return end @order_details = @order_details . order ( "order_details.created_at DESC" ) . paginate ( page : params [ :page ] ) end
GET /orders
all my orders
GET / orders all my orders
# new or in process