Hi and thanks for taking the time to answer my question.
I have the following code in my controller:
.
.
.
var project = this.store.createRecord('project', {
name: projectName,
});
project.save();
alert(project.get('id') + project.get('name'));
.
.
.
This adds the record successfully to the db and the front end is automatically refreshed to reflect these changes. When the alert is executed however, only the name is printed.
For the ID i get null.
Basically I need to get the id value returned from the server after the record has been successfully isnerted. I checked the returned JSON:
{"project":{"id":6,"name":"dfgdgf", "created_at":"2014-01-02T08:37:57.491Z","updated_at":"2014-01-02T08:37:57.491Z"}}
so the id field is contained in the json response. Could the problem occur because the server also returns two fields (created_at and updated_at) which are not found in the ember model??
Thank you so much!
EDIT:
I included created_at
and updated_at
in my model in ember and am still getting null when I try to call project.get('id');
Any suggestions?
Thanks