Open danvk opened 7 years ago
I'm trying to use PUT to update a model with associations.
PUT
I have a Map model which HasMany Layers. Map 4 has one layer in the DB. map.json specifies two layers.
Map
Layer
map.json
When I use PUT to update map 4, the request succeeds and returns a modified Map:
$ http PUT localhost:1337/object/map/4 < map.json HTTP/1.1 200 OK Connection: keep-alive Content-Length: 514 Content-Type: application/json; charset=utf-8 Date: Tue, 01 Nov 2016 19:03:54 GMT ETag: W/"202-avvKiF6AQG/hPzW3CJAakQ" X-Powered-By: Express { "author": "danvk", "baseMapStyle": "{}", "createdAt": "2016-11-01T16:05:30.086Z", "description": "This map has two layers", "id": 4, "lat": 43.22, "layer": [ { "config": "config = {}", "description": "It's a really great layer, trust me.", "name": "My layer", "sqlQuery": "SELECT * FROM dataset", "zIndex": 0 }, { "config": "config = {}", "description": "It's an even better layer, trust me.", "name": "My layer", "sqlQuery": "SELECT * FROM dataset", "zIndex": 1 } ], "lng": -137.22, "name": "My Map", "updatedAt": "2016-11-01T19:03:54.447Z", "zoomLevel": 12 }
A subsequent GET, however, shows that the new data wasn't written to the database:
GET
$ http GET localhost:1337/object/map/4 HTTP/1.1 200 OK Connection: keep-alive Content-Length: 744 Content-Type: application/json; charset=utf-8 Date: Tue, 01 Nov 2016 19:12:39 GMT ETag: W/"2e8-bsUeBJOAcTqI1e8ugkbqpg" X-Powered-By: Express { "author": "danvk", "baseMapStyle": "{}", "createdAt": "2016-11-01T16:05:30.086Z", "description": "This map has two layers", "id": 4, "lat": 43.22, "layer": [ { "SavedMapId": 4, "createdAt": "2016-11-01T16:05:30.123Z", "description": null, "id": 3, "name": "Untitled Layer", "sqlQuery": "SELECT *\nFROM blah", "updatedAt": "2016-11-01T16:05:30.123Z", "zIndex": 1 } ], "lng": -137.22, "name": "My Map", "updatedAt": "2016-11-01T19:03:54.447Z", "zoomLevel": 12 }
I'm running from HEAD using Postgres.
HEAD
cc @asmodehn
I'm trying to use
PUT
to update a model with associations.I have a
Map
model which HasManyLayer
s. Map 4 has one layer in the DB.map.json
specifies two layers.When I use
PUT
to update map 4, the request succeeds and returns a modifiedMap
:A subsequent
GET
, however, shows that the new data wasn't written to the database:I'm running from
HEAD
using Postgres.