Hi everybody,
I’ve got this doubt: I want to send store data remotely in a server in my app,
I’ve create my customize adapter and serializer.
But i don 't well understand, in the method createRecord(store, type, model), that I have override in my adapter, what i should pass as these parameters.
As a user of ember-data, you shouldn’t ever have to call createRecord
directly – ember-data will call createRecord
internally any time you ask it to save a new record. You’ll save a record using myNewRecord.save()
or something, and ember will internally call createRecord
. Furthermore, ember will pass three parameters to createRecord
– store
, type
, and snapshot
– that hold the information needed to create the record.
Your job, if you are writing your own adapter, is to fill out createRecord
with an AJAX call or whatever you think it needs to perform an API call that saves data remotely. Use the passed parameters store
, type
, and snapshot
to access the data needed to create the record.
Check out the example in the documentation to see one possible way of filling out createRecord
.