Created
January 13, 2012 16:45
-
-
Save sgharms/1607438 to your computer and use it in GitHub Desktop.
BB reset documentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| reset collection.reset(models, [options]) | |
| Adding and removing models one at a time is all well and good, but | |
| sometimes you have so many models to change that you'd rather just | |
| update the collection in bulk. Use reset to replace a collection with a | |
| new list of models (or attribute hashes), triggering a single "reset" | |
| event at the end. Pass {silent: true} to suppress the "reset" event. | |
| Using reset with no arguments is useful as a way to empty the | |
| collection. | |
| Here's an example using reset to bootstrap a collection during | |
| initial page load, in a Rails application. | |
| <script> | |
| Accounts.reset(<%= @accounts.to_json %>); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment