发送多个参数到Web服务

时间:2012-05-07 20:07:50

标签: ios ruby json web-services params

我有这样的JSON。

[
   {
      "created_at": "2012-05-07T19:17:16Z",
      "id": 80,
      "order_date": "2012-05-07 22:17:14",
      "order_done": false,
      "order_total": "14.7",
      "order_uuid": "e10655868d12d9855b83e02efb026eef056f1d92",
      "updated_at": "2012-05-07T19:17:17Z",
      "order_details": [
         {
            "created_at": "2012-05-07T19:17:17Z",
            "food_count": 2,
            "food_name": "Baileys Shaken with Ice",
            "food_place": "El Gringo Music Saloon",
            "food_price": "8.4",
            "id": 146,
            "order_id": 80,
            "updated_at": "2012-05-07T19:17:17Z"
         },
         {
            "created_at": "2012-05-07T19:17:17Z",
            "food_count": 1,
            "food_name": "Baileys Irish Martini",
            "food_place": "O'Malley's",
            "food_price": "6.3",
            "id": 147,
            "order_id": 80,
            "updated_at": "2012-05-07T19:17:17Z"
         }
      ]
   }
]

现在我想将它们从iOS发送给Ruby Web Service。

是否可以使用一个请求POST将它们发送到Web服务?

现在我使用2个请求POST或1个请求POST和1个请求UPDATE => ITS BAD !!!!

2 个答案:

答案 0 :(得分:2)

我认为如果您开始使用有关使用服务和JSON的Web的一些教程将会很好。与thisthis或甚至this

一样

答案 1 :(得分:0)

accepts_nested_attributes_for :order_details模型中设置Order以接受您正在推送的阵列:)