-2

我有一个这样的 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 服务。

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

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

4

2 回答 2

2

我认为如果你开始学习一些关于 Web 使用服务和 JSON 的教程会很好。像这样这样甚至这样

于 2012-05-07T20:13:24.973 回答
0

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

于 2012-05-07T20:10:27.770 回答