Permalink
Browse files

Replace deprecated ember_assert with Ember.assert

This fixes all instances of the old un-namespaced ember_* functions.
  • Loading branch information...
1 parent 9a070be commit b4a415e1be4db3673a102b3fdc45b6bd22d46d59 @joliss committed May 6, 2012
@@ -5,7 +5,7 @@ DS.fixtureAdapter = DS.Adapter.create({
find: function(store, type, id) {
var fixtures = type.FIXTURES;
- ember_assert("Unable to find fixtures for model type "+type.toString(), !!fixtures);
+ Ember.assert("Unable to find fixtures for model type "+type.toString(), !!fixtures);
if (fixtures.hasLoaded) { return; }
setTimeout(function() {
@@ -21,7 +21,7 @@ DS.fixtureAdapter = DS.Adapter.create({
findAll: function(store, type) {
var fixtures = type.FIXTURES;
- ember_assert("Unable to find fixtures for model type "+type.toString(), !!fixtures);
+ Ember.assert("Unable to find fixtures for model type "+type.toString(), !!fixtures);
var ids = fixtures.map(function(item, index, self){ return item.id; });
store.loadMany(type, ids, fixtures);
@@ -207,10 +207,10 @@ DS.RESTAdapter = DS.Adapter.extend({
if (!sideloadedType) {
mappings = get(this, 'mappings');
- ember_assert("Your server returned a hash with the key " + prop + " but you have no mappings", !!mappings);
+ Ember.assert("Your server returned a hash with the key " + prop + " but you have no mappings", !!mappings);
sideloadedType = get(mappings, prop);
- ember_assert("Your server returned a hash with the key " + prop + " but you have no mapping for it", !!sideloadedType);
+ Ember.assert("Your server returned a hash with the key " + prop + " but you have no mapping for it", !!sideloadedType);
}
this.loadValue(store, sideloadedType, json[prop]);
@@ -228,9 +228,9 @@ DS.RESTAdapter = DS.Adapter.extend({
buildURL: function(record, suffix) {
var url = [""];
- ember_assert("Namespace URL (" + this.namespace + ") must not start with slash", !this.namespace || this.namespace.toString().charAt(0) !== "/");
- ember_assert("Record URL (" + record + ") must not start with slash", !record || record.toString().charAt(0) !== "/");
- ember_assert("URL suffix (" + suffix + ") must not start with slash", !suffix || suffix.toString().charAt(0) !== "/");
+ Ember.assert("Namespace URL (" + this.namespace + ") must not start with slash", !this.namespace || this.namespace.toString().charAt(0) !== "/");
+ Ember.assert("Record URL (" + record + ") must not start with slash", !record || record.toString().charAt(0) !== "/");
+ Ember.assert("URL suffix (" + suffix + ") must not start with slash", !suffix || suffix.toString().charAt(0) !== "/");
if (this.namespace !== undefined) {
url.push(this.namespace);
@@ -52,6 +52,6 @@ var hasAssociation = function(type, options, one) {
};
DS.belongsTo = function(type, options) {
- ember_assert("The type passed to DS.belongsTo must be defined", !!type);
+ Ember.assert("The type passed to DS.belongsTo must be defined", !!type);
return hasAssociation(type, options);
};
@@ -38,6 +38,6 @@ var hasAssociation = function(type, options) {
};
DS.hasMany = function(type, options) {
- ember_assert("The type passed to DS.hasMany must be defined", !!type);
+ Ember.assert("The type passed to DS.hasMany must be defined", !!type);
return hasAssociation(type, options);
};
@@ -28,7 +28,7 @@ DS.Model.reopenClass({
DS.attr = function(type, options) {
var transform = DS.attr.transforms[type];
- ember_assert("Could not find model attribute of type " + type, !!transform);
+ Ember.assert("Could not find model attribute of type " + type, !!transform);
var transformFrom = transform.from;
var transformTo = transform.to;
@@ -250,15 +250,15 @@ DS.Model = Ember.Object.extend(Ember.Evented, {
var data = get(this, 'data');
if (data && key in data) {
- ember_assert("You attempted to access the " + key + " property on a record without defining an attribute.", false);
+ Ember.assert("You attempted to access the " + key + " property on a record without defining an attribute.", false);
}
},
setUnknownProperty: function(key, value) {
var data = get(this, 'data');
if (data && key in data) {
- ember_assert("You attempted to set the " + key + " property on a record without defining an attribute.", false);
+ Ember.assert("You attempted to set the " + key + " property on a record without defining an attribute.", false);
} else {
return this._super(key, value);
}
@@ -35,7 +35,7 @@ DS.ManyArray = DS.RecordArray.extend({
var stateManager = get(this, 'stateManager');
added = added.map(function(record) {
- ember_assert("You can only add records of " + (get(this, 'type') && get(this, 'type').toString()) + " to this association.", !get(this, 'type') || (get(this, 'type') === record.constructor));
+ Ember.assert("You can only add records of " + (get(this, 'type') && get(this, 'type').toString()) + " to this association.", !get(this, 'type') || (get(this, 'type') === record.constructor));
if (pendingParent) {
record.send('waitingOn', parentRecord);
@@ -573,11 +573,11 @@ DS.Store = Ember.Object.extend({
primaryKey = type.proto().primaryKey;
- // TODO: Make ember_assert more flexible and convert this into an ember_assert
+ // TODO: Make Ember.assert more flexible and convert this into an Ember.assert
if (hash) {
- ember_assert("The server must provide a primary key: " + primaryKey, get(hash, primaryKey));
+ Ember.assert("The server must provide a primary key: " + primaryKey, get(hash, primaryKey));
} else {
- ember_assert("The server did not return data, and you did not create a primary key (" + primaryKey + ") on the client", get(get(record, 'data'), primaryKey));
+ Ember.assert("The server did not return data, and you did not create a primary key (" + primaryKey + ") on the client", get(get(record, 'data'), primaryKey));
}
clientId = get(record, 'clientId');
@@ -750,7 +750,7 @@ DS.Store = Ember.Object.extend({
if (hash === undefined) {
hash = id;
var primaryKey = type.proto().primaryKey;
- ember_assert("A data hash was loaded for a record of type " + type.toString() + " but no primary key '" + primaryKey + "' was provided.", primaryKey in hash);
+ Ember.assert("A data hash was loaded for a record of type " + type.toString() + " but no primary key '" + primaryKey + "' was provided.", primaryKey in hash);
id = hash[primaryKey];
}
@@ -120,12 +120,12 @@ DS.Transaction = Ember.Object.extend({
*/
add: function(record) {
// we could probably make this work if someone has a valid use case. Do you?
- ember_assert("Once a record has changed, you cannot move it into a different transaction", !get(record, 'isDirty'));
+ Ember.assert("Once a record has changed, you cannot move it into a different transaction", !get(record, 'isDirty'));
var recordTransaction = get(record, 'transaction'),
defaultTransaction = getPath(this, 'store.defaultTransaction');
- ember_assert("Models cannot belong to more than one transaction at a time.", recordTransaction === defaultTransaction);
+ Ember.assert("Models cannot belong to more than one transaction at a time.", recordTransaction === defaultTransaction);
this.adoptRecord(record);
},

0 comments on commit b4a415e

Please sign in to comment.