Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Only attempt to sideload keys with array values #833

Closed
wants to merge 3 commits into from

2 participants

Adam Hawkins Igor Terzic
Adam Hawkins

No description provided.

Igor Terzic
Owner

Why does adding ok fix the test? I think in this case we should throw an assert and not silently ignore the key. Do you have a use case for ignoring keys?

Adam Hawkins
Igor Terzic
Owner

I feel like we would want a more comprehensive solution for this as you could reasonably expect the metadata to be an array as well. Maybe some api for specifying non sideloaded keys or smth? @tomdale ?

Igor Terzic
Owner

I think #815 solves this use case?

Igor Terzic igorT closed this
Igor Terzic
Owner

#815 has been merged in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 22, 2013
  1. Only attempt to sideload keys with array values

    Adam Hawkins authored
Commits on Mar 23, 2013
  1. Fix failing test

    twinturbo authored
  2. Prefer Ember.isArray

    twinturbo authored
This page is out of date. Refresh to see the latest.
1  packages/ember-data/lib/serializers/json_serializer.js
View
@@ -222,6 +222,7 @@ DS.JSONSerializer = DS.Serializer.extend({
for (var prop in json) {
if (!json.hasOwnProperty(prop) ||
+ !Ember.isArray(json[prop]) ||
prop === root ||
prop === this.configOption(type, 'meta')) {
continue;
3  packages/ember-data/tests/integration/rollback_test.js
View
@@ -593,6 +593,9 @@ test("A deleted record should be restored to a belongsTo relationship if the tra
var post = store.find(Post, 1);
var comment1 = store.find(Comment, 1);
+ ok(comment1.get('post'), 'precond - belongsTo set');
+ ok(!Ember.isEmpty(post.get('comments')), 'precond - hasMany set');
+
var oldValue = comment1.get('post');
var transaction = store.transaction();
Something went wrong with that request. Please try again.