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

.model should always serialize Observes #444

Closed
daffl opened this Issue Jul 3, 2013 · 0 comments

Comments

Projects
None yet
1 participant
@daffl
Contributor

daffl commented Jul 3, 2013

The check in https://github.com/bitovi/canjs/blob/master/model/model.js#L1028:

if ( attributes instanceof this ) {
    attributes = attributes.serialize();
}

Should check for instanceof can.Observe and serialize any Observe since running an Observe through .model causes an error.

zkat pushed a commit that referenced this issue Jul 17, 2013

Josh Marchán
can.Model.model attribute serialization fix
Instead of checking instanceof, just check if it's something with a
serialize function attached to it. This allows can.Model.model to
accept can.Observe (and anything else that's "serializable").

This does have the side-effect that "serialize" becomes a reserved
property, but there's other parts of canjs where this happens, such as
can.Observe#bind

Fixes #444

@daffl daffl closed this in #449 Jul 18, 2013

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