pathable / supermodel

Supermodel - Minimal Model Tracking for Backbonejs
http://pathable.github.io/supermodel
MIT License
229 stars 36 forks source link

Extracted find functionality from the create method #44

Closed andru closed 10 years ago

andru commented 10 years ago

It was useful to me to have a simple way to find if a model matching a set of attributes exists without necessarily creating it.

This pull request extracts the logic responsible for finding a model in the model.all collection from the model.create method into a new model.find. The model.create method is updated to use the new find method.

braddunbar commented 10 years ago

This seems like a good addition, though I think the merge functionality belongs in create. Gonna fix up the getByCid issue before merging. :+1:

braddunbar commented 10 years ago

Merged above and tweaked a bit in 8649210abc83c3c27e4149975ea45461e4e09e68. Let me know what you think!