Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look ahead one step when building nested structures (#78) #113

Merged
merged 2 commits into from
Feb 19, 2014

Conversation

karlwestin
Copy link
Contributor

To determine whether a newly created nest-level should be an object or
an array, we need to look at the next value in the path.
Please run the tests without the patch in backbone-nested to see the bug
in action. Thanks

Closes #78

an array, we need to look at the next value in the path.
Please run the tests without the patch in backbone-nested to see the bug
in action. Thanks

Closes afeld#78
var attr = _.last(path);
var attrStr = Backbone.NestedModel.createAttrStr(path);


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra whitespace.

@gkatsev
Copy link
Collaborator

gkatsev commented Feb 18, 2014

We need to check the next item because otherwise, it'll assume that we're creating a regular object rather than an array, right?
Looks good (other than a bit extra whitespace).

@karlwestin
Copy link
Contributor Author

yeah thats how the bug came out
so this bug only really came into effect when you started with setting a big key where nothing of the structure existed before

if you did

new Backbone.NestedModel({
   array: [{ myObject: 10 }]
})

things came out ok, but if you did

new Backbone.NestedModel({
   "array[0].myObject": 10
})

you'd see the bug

Fixed the whitespace, thanks for seeing it

@afeld
Copy link
Owner

afeld commented Feb 19, 2014

👍

afeld added a commit that referenced this pull request Feb 19, 2014
Look ahead one step when building nested structures (#78)
@afeld afeld merged commit 1b7aa64 into afeld:master Feb 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set array items to model with attribute path fails
3 participants