59 Commits

Author SHA1 Message Date
Brad Dunbar
50e8103fdf check for duplicate models/ids 2012-01-30 15:24:41 -05:00
Jeremy Ashkenas
ab164c450d Overhauling 'validate' -- Receives the computed new state of the attrs, not just the delta. Now runs on model create, raising an exception if you try to 'new' and invalid model ... also runs even if changed silently. 2012-01-23 18:16:20 -05:00
Jeremy Ashkenas
910ca3c190 Merge pull request #866 from braddunbar/add-tweaks
Collection#add tweaks
2012-01-17 22:50:17 -08:00
Brad Dunbar
09ab8cb17d Collection#add tweaks
* leave collection in a consistent state after throw
* correct indices
2012-01-17 23:53:02 -05:00
Brad Dunbar
397d11e340 equals is deprecated; use equal instead
http://docs.jquery.com/QUnit/equal#actualexpectedmessage
2012-01-17 23:52:12 -05:00
Jeremy Ashkenas
cea56e523a Fixes #563. Initial draft of 'wait: true' for pessimistic instead of optimistic save() create() and destroy(). Makes it easier to have your asynchronous UI and eat it too. 2012-01-17 15:26:26 -05:00
Jeremy Ashkenas
09110a6656 removing erroneous console.log 2012-01-17 11:18:17 -05:00
Jeremy Ashkenas
2d02a3cfb6 Fixes #861, better error message for adding invalid models to a collection. 2012-01-17 10:54:03 -05:00
Jeremy Ashkenas
7ba0275613 Fixes #574, clone 'models' before removing, so as to allow collection.remove(collection.models) 2012-01-17 10:29:01 -05:00
Jeremy Ashkenas
2dce413247 Adding options.index to Collection#add and #remove. 2012-01-13 17:20:15 -05:00
Jeremy Ashkenas
a8bd142b64 Fixes #714, assign model.collection early, so that those overriding set() can use it from the get-go. 2012-01-13 13:19:28 -05:00
Jeremy Ashkenas
a49bb4f3e1 Fixes #811 -- allow you to pass a context when unbinding events as well. 2012-01-12 17:09:15 -05:00
Jeremy Ashkenas
1d90bb9cfc binding the comparator function before using it, so that you can rely on properties of your collection within it. 2012-01-12 15:13:22 -05:00
Jeremy Ashkenas
8cfb243b8e Fixes #836, Fixes #708 -- going back to previous stance: two models with the same id can't be added to the same collection. 2012-01-11 17:03:30 -05:00
Jeremy Ashkenas
bf1ffbeb67 nice refactor. removed _add and _remove and moved 'em in to the public API. 2012-01-11 13:45:16 -05:00
Brad Dunbar
c8919c4b05 collection.add should not alter models array 2012-01-10 17:18:11 -05:00
Jeremy Ashkenas
1715c181ad Fixes #81 -- optimize for addition of large arrays of models, not for individual inserts. 2012-01-06 15:42:43 -05:00
Jeremy Ashkenas
6b3ff7b035 Fixes #9, Backbone comparators can now be either sort() or sortBy() iterators. 2012-01-06 14:53:43 -05:00
Jeremy Ashkenas
dd83f2057c Fixes #788 2011-12-19 11:20:37 -05:00
Magnus Holm
67f689df9c Col.fetch() should create models with parse:true:
This is done in two steps:

1. Col.fetch() now defaults to parse:true
2. Col.reset() and _prepareModel now passes along
   parse:true.

This means that Col.add() also accepts the
parse:true option.
2011-12-04 18:27:36 +01:00
Tim Branyen
9982e314cb Merge pull request #700 from iros/673
#673 - Adding index as a property on the options object that gets passed
2011-10-29 13:30:58 -07:00
Irene Ros
80769fcf99 #673 - Adding index as a property on the options object that gets passed when the add/remove callbacks get triggered on a collection. 2011-10-29 16:29:18 -04:00
Alex Graul
567e0a3c2d Fix for adding models with custom set methods to collections, issue #539 2011-10-29 13:23:01 -04:00
Jeremy Ashkenas
6d07d2f0e2 multiple models with the same ID should be allowed in a collection. 2011-07-05 16:40:23 -04:00
Niall Smart
0853866aab Collection.add should fail if duplicate id/cid exists 2011-06-13 18:11:04 -07:00
Jeremy Ashkenas
e01ad9dd5b Merging in #232. Allow destroy() to be called on non-persisted objects ... just in case. 2011-05-27 11:30:48 -04:00
Jeremy Ashkenas
cf3215139a initial draft of a 0.5.0 branch 2011-05-26 10:54:28 -04:00
Pablo A. Torres Navarrete
0f118ecb6e Add a failing test for Collection.create not running callbacks 2011-04-21 12:07:11 -05:00
Jacek Becela
223c4fb210 Add failing test for #319 2011-04-15 09:32:46 +02:00
Raimonds Simanovskis
5a89ed3272 destroy of non-persisted model should not call sync 2011-02-15 15:17:20 +02:00
Jeremy Ashkenas
c6d2c69d82 ditto 2011-02-07 14:49:56 -05:00
Kris Jordan
7442f826f1 Forcing Collection.create to run through validation before saving. 2011-02-06 01:13:52 -05:00
Joshua Peek
14000a8bb9 Improve multiple collection support
Preserve original model collection when adding/removing from another collection
Destroying a model removes it from all collections
2011-01-22 10:15:51 -06:00
Jeremy Ashkenas
6ea500b0dd Fixing un-released models from refresh'd collections. Issue #128 2010-12-08 16:38:33 -05:00
Jeremy Ashkenas
6a0ac93086 Fixing Issue #109 -- ignore 'add' and 'remove' events that originate from models shared with other collections. 2010-12-02 09:31:55 -05:00
Jeremy Ashkenas
6e4046df02 All Backbone events now pass through their options as the ffinal argument. 2010-11-30 16:04:55 -05:00
Jeremy Ashkenas
f63c99511e Merge branch 'master' of github.com:documentcloud/backbone 2010-11-18 09:43:01 -05:00
Jeremy Ashkenas
327ba8c54d Fixing id=0 2010-11-18 09:42:54 -05:00
Samuel Clay
52c460bc12 Allowing collections to remove models by either Cid or Id (prefering cid). 2010-11-17 14:50:39 -05:00
Jeremy Ashkenas
6e7894d8fa Streamlined event delegation from models through collections. Added documentation for 0.2.0 enhancements. 2010-10-25 11:23:04 -04:00
Jeremy Ashkenas
f3a8dcd16b Merging in Collection#toJSON 2010-10-20 16:01:56 -04:00
Jeremy Ashkenas
a895bbb098 fixing chain() test. 2010-10-19 15:50:02 -04:00
Nick Fitzgerald
8d7eff8cd2 Adding chain() to the Collection prototype 2010-10-19 15:48:59 -04:00
Jeremy Ashkenas
e7ce57cc1d Adding the beginnings of a speed suite to the Test page. 2010-10-14 14:46:53 -04:00
Jeremy Ashkenas
831090329f Issue #8 -- a number of improvements to the documentation. 2010-10-14 10:29:18 -04:00
Jeremy Ashkenas
091e266077 Adding basic tests for initialize. 2010-10-13 17:33:20 -04:00
Jeremy Ashkenas
f09e791402 removing toString 2010-10-13 11:04:44 -04:00
Jeremy Ashkenas
8e7405e17a updating rest tests. 2010-10-12 16:01:14 -04:00
Jeremy Ashkenas
11c6ebb7fc add, remove, get, getbycid, at 2010-10-12 13:52:59 -04:00
Jeremy Ashkenas
cbbba479ea ... 2010-10-12 09:59:15 -04:00