Created
August 28, 2014 17:50
-
-
Save bmax/0b1b008b9541ff1785a5 to your computer and use it in GitHub Desktop.
Changing buildURL according to the record type.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
createRecord: function(store, type, record) { | |
var data = {}; | |
var serializer = store.serializerFor(type.typeKey); | |
serializer.serializeIntoHash(data, type, record, { includeId: true }); | |
if (record.get('isNew') && type.typeKey == 'room' && data.room.operation_id) | |
{ | |
var op_id = data.room.operation_id; | |
delete data.room.operation_id; | |
return this.ajax(this.buildURL('operations/' + op_id + '/room', null, record), "POST", { data: data }); | |
} else { | |
return this.ajax(this.buildURL(type.typeKey, null, record), "POST", { data: data }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment