app/controllers/spree/api/orders_controller.rb in spree_api-1.3.0.rc1 vs app/controllers/spree/api/orders_controller.rb in spree_api-1.3.0.rc2

- old
+ new

@@ -1,17 +1,21 @@ module Spree module Api class OrdersController < Spree::Api::BaseController + respond_to :json + before_filter :authorize_read!, :except => [:index, :search, :create] def index # should probably look at turning this into a CanCan step raise CanCan::AccessDenied unless current_api_user.has_spree_role?("admin") @orders = Order.ransack(params[:q]).result.page(params[:page]).per(params[:per_page]) + respond_with(@orders) end def show + respond_with(@order) end def create @order = Order.build_from_api(current_api_user, nested_params) next!(:status => 201) @@ -19,10 +23,10 @@ def update authorize! :update, Order if order.update_attributes(nested_params) order.update! - render :show + respond_with(order, :default_template => :show) else invalid_resource!(order) end end