Compatibility with Backbone 0.9.10 (fixes #9) #10

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@bgarret

bgarret commented Feb 10, 2013

There were two additional problems besides the one in issue #9 :

  • this._byCid does not exist anymore in 0.9.10
  • !model.id breaks with a numeric id set to 0

Using the get method here is much cleaner as it is guaranteed to abstract between the different versions of Backbone. Besides, not depending on private interfaces is always good 馃槈

As @Crisfole said, this.models was not initialized properly.

The test suite now passes with both Backbone 0.9.10 and 0.5.3.

@Crisfole

This comment has been minimized.

Show comment Hide comment
@Crisfole

Crisfole Mar 1, 2013

馃憤 Thanks for the fix. I had no idea fixing it would be that simple...

Crisfole commented Mar 1, 2013

馃憤 Thanks for the fix. I had no idea fixing it would be that simple...

@jtuulos

This comment has been minimized.

Show comment Hide comment
@jtuulos

jtuulos Mar 20, 2013

Also, since Collection#_performValidation has been removed in Backbone 0.9.10 Subset#create fails in _prepareModel. Replacing

if (model.validate && !model._performValidation(model.attributes, options)) { ...

with

if (!model._validate(model.attributes, options)) { ...

seems to work (copied from Backbone source).

jtuulos commented Mar 20, 2013

Also, since Collection#_performValidation has been removed in Backbone 0.9.10 Subset#create fails in _prepareModel. Replacing

if (model.validate && !model._performValidation(model.attributes, options)) { ...

with

if (!model._validate(model.attributes, options)) { ...

seems to work (copied from Backbone source).

@bgarret

This comment has been minimized.

Show comment Hide comment
@bgarret

bgarret Mar 20, 2013

@jtuulos Good catch, I guess this means that there aren't any tests for the creation of a subset with validatable models, I'll update the pull request with your fix.

bgarret commented Mar 20, 2013

@jtuulos Good catch, I guess this means that there aren't any tests for the creation of a subset with validatable models, I'll update the pull request with your fix.

@bgarret bgarret closed this Jan 28, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment