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

add documentation about collections containing polymorphic models. Fixes... #2350

Merged
merged 1 commit into from
Mar 9, 2013

Conversation

hshoff
Copy link
Contributor

@hshoff hshoff commented Mar 9, 2013

Fixes #2338 and borrows from an example Jeremy wrote in #793 (comment)

@braddunbar
Copy link
Collaborator

Very nice. This has needed some documentation for quite some time. Thanks @hshoff!

braddunbar added a commit that referenced this pull request Mar 9, 2013
add documentation about collections containing polymorphic models. Fixes...
@braddunbar braddunbar merged commit 0224e6d into jashkenas:master Mar 9, 2013
@hshoff
Copy link
Contributor Author

hshoff commented Mar 9, 2013

🍻

@hshoff hshoff deleted the polymorphic branch March 9, 2013 00:53
return new PublicDocument(attrs, options);
} else {
return new PrivateDocument(attrs, options);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be good to show return this as well. To "pass-through".

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm...I don't follow. Why return this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Because it's not obvious how to pass through and use the default model type otherwise.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Returning this wouldn't do that anyway though, right? It would return an empty object. You could presumably do Backbone.Model.apply(this, arguments) or return new Backbone.Model(attrs, options) though I'm not sure that's any more instructive in this case.

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.

Proposal to Improve Collection.model Documentation
3 participants