app/controllers/spree/api/orders_controller.rb in spree_api-2.2.4 vs app/controllers/spree/api/orders_controller.rb in spree_api-2.2.5

- old
+ new

@@ -1,8 +1,9 @@ module Spree module Api class OrdersController < Spree::Api::BaseController + wrap_parameters false skip_before_filter :check_for_user_or_api_key, only: :apply_coupon_code skip_before_filter :authenticate_user, only: :apply_coupon_code # Dynamically defines our stores checkout steps to ensure we check authorization on each step. @@ -15,11 +16,11 @@ def cancel find_order authorize! :update, @order, params[:token] @order.cancel! - render :show + respond_with(@order, :default_template => :show) end def create authorize! :create, Order @order = Spree::Core::Importer::Order.import(current_api_user, order_params) @@ -67,10 +68,10 @@ end end def mine if current_api_user.persisted? - @orders = current_api_user.orders.ransack(params[:q]).result.page(params[:page]).per(params[:per_page]) + @orders = current_api_user.orders.reverse_chronological.ransack(params[:q]).result.page(params[:page]).per(params[:per_page]) else render "spree/api/errors/unauthorized", status: :unauthorized end end