You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This cause inconsistensy with my Db where ids are Numbers, all insert requests with belongsTo don't pass the validation process (the ref must be a number but ember cast it to a string).
I can understand that you need internally to play with strings, but why not keeping the base type for all queries? There is propably a way to do this like defining the type of the belongsTo, or maybe the type of the primary key for you to cast it before querying...
line 1174:
// Implementors Note:
//
// The variables in this file are consistently named according to the following
// scheme:
//
// * +id+ means an identifier managed by an external source, provided inside
// the data provided by that source. These are always coerced to be strings
// before being used internally.
// * +clientId+ means a transient numerical identifier generated at runtime by
// the data store. It is important primarily because newly created objects may
// not yet have an externally generated id.
// * +reference+ means a record reference object, which holds metadata about a
// record, even if it has not yet been fully materialized.
// * +type+ means a subclass of DS.Model.
// Used by the store to normalize IDs entering the store. Despite the fact
// that developers may provide IDs as numbers (e.g., `store.find(Person, 1)`),
// it is important that internally we use strings, since IDs may be serialized
// and lose type information. For example, Ember's router may put a record's
// ID into the URL, and if we later try to deserialize that URL and find the
// corresponding record, we will not know if it is a string or a number.
var coerceId = function(id) {
return id == null ? null : id+'';
};
The text was updated successfully, but these errors were encountered:
You could override serializeBelongsTo to cast the strings as numbers. I think there should probably be an easier hook to handle this but not sure how exactly it should look: whether it should only be a one hook for both primaryKey and relationships.
Tested with beta 3
This cause inconsistensy with my Db where ids are Numbers, all insert requests with belongsTo don't pass the validation process (the ref must be a number but ember cast it to a string).
I can understand that you need internally to play with strings, but why not keeping the base type for all queries? There is propably a way to do this like defining the type of the belongsTo, or maybe the type of the primary key for you to cast it before querying...
line 1174:
The text was updated successfully, but these errors were encountered: