Fix list unit and supplier main board acceptance specs

This commit is contained in:
2014-05-28 15:16:08 +02:00
parent 4855b2e8e0
commit e9554ea3e7
14 changed files with 133 additions and 121 deletions
+3 -1
View File
@@ -1,6 +1,8 @@
module Users
class OrdersController < Users::ApplicationController
respond_to :json
# Used by the user Ember app
def create
render json: {}, status: :unprocessable_entity and return unless params[:order].present? && params[:order][:product_orders].present?
converted_order = params[:order][:product_orders].each_with_object({}){|po, o| o[po[:product_id]] = po[:quantity] }
@@ -18,7 +20,7 @@ module Users
list = List.from_table( table, current_user )
end
order = list.place_order converted_order
order = list.place_order products: converted_order, user: current_user
render json: order, serializer: OrderSerializer
end
end