I am using rocket_pants
gem to build backend API https://github.com/Sutto/rocket_pants
It have a specific format to output data:
{
"response":[
{"id":1,"title":"Object Title","description":"Object Description"},
{"id":1,"title":"Object Title","description":"Object Description"} ],
"count":2,
"pagination": {
"previous":null,
"next":null,
"current":1,
"per_page":30,
"count":2,
"pages":1}
}
I am using Batman.RailsStorage
to persist models. But actions like MyApp.Model.get('all')
works fine on the backend but they actually do not parse and load model objects.
Can you guide me how to configure StorageAdapter
or write new one to handle such kind of data format?
You could try overriding the
collectionJsonNamespace
method (defined onBatman.RestStorage
).I see that it's used after a
readAll
operation to get records from the HTTP response.For example:
Then in your model
Does that work?