[deprecations] Don't use snapshot.get()

This commit is contained in:
Piotr Sarnacki 2016-01-11 13:26:43 +01:00
parent dcac5d4150
commit 1c33475ff6
3 changed files with 8 additions and 8 deletions

View File

@ -7,7 +7,7 @@ export default ApplicationAdapter.extend({
buildURL(type, id, record) {
var delimiter, repoId, url;
url = this._super.apply(this, arguments);
if (record && (repoId = Ember.get(record, 'repo.id'))) {
if (record && record.belongsTo('repo') && (repoId = record.belongsTo('repo').id)) {
delimiter = url.indexOf('?') !== -1 ? '&' : '?';
url = "" + url + delimiter + "repository_id=" + repoId;
}
@ -15,11 +15,11 @@ export default ApplicationAdapter.extend({
},
updateRecord(store, type, record) {
var data, id, serializer;
var data, serializer;
data = {};
serializer = store.serializerFor(type.modelName);
serializer.serializeIntoHash(data, type, record);
id = Ember.get(record, 'id');
var id = record.id;
return this.ajax(this.buildURL(type.modelName, id, record), "PATCH", {
data: data
});

View File

@ -9,19 +9,19 @@ export default ApplicationAdapter.extend({
},
deleteRecord(store, type, record) {
var id;
id = Ember.get(record, 'id');
var id = record.id;
return this.ajax(this.urlPrefix() + '/ssh_key/' + id, "DELETE");
},
createRecord(store, type, record) {
var data, id, serializer;
var data, serializer;
data = {};
serializer = store.serializerFor(type.modelName);
serializer.serializeIntoHash(data, type, record, {
includeId: true
});
id = Ember.get(record, 'id');
var id = record.id;
return this.ajax(this.urlPrefix() + '/ssh_key/' + id, "PATCH", {
data: data
});

View File

@ -19,10 +19,10 @@ window.deprecationWorkflow.config = {
{ handler: "log", matchMessage: "Function#observesBefore is deprecated and will be removed in the near future." },
{ handler: "log", matchMessage: "Ember.addBeforeObserver is deprecated and will be removed in the near future." },
{ handler: "log", matchMessage: "Ember.removeBeforeObserver is deprecated and will be removed in the near future." },
{ handler: "log", matchMessage: "Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead." },
// TODO
{ handler: "silence", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." },
{ handler: "silence", matchMessage: "The filter API will be moved into a plugin soon. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page" },
{ handler: "silence", matchMessage: "Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead." },
]
};