63 Commits

Author SHA1 Message Date
Chris Moore
3145b4db22 isNew should use id, not idAttribute 2011-07-25 17:48:09 -04:00
Jeremy Ashkenas
da6d0b90ca resolving merge conflict, removing old test. 2011-07-05 09:42:15 -04:00
Jeremy Ashkenas
fcbedad8cd Addinga a test case for #459 2011-07-05 09:00:12 -04:00
Gavin Huang
4e9037b018 Model is no longer considered to be new if its id is a falsey value 2011-06-23 16:09:41 +08:00
Gavin Huang
573c347553 Fix unit test for model.isNew() 2011-06-23 16:08:16 +08:00
Matt Smith
d3a0b64603 remove model_with helper from test 2011-05-31 09:31:04 -04: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
9accf97e9e Issue #246 -- never fire nested change events for the same model. The top-level one will do. 2011-05-27 10:29:14 -04:00
Matt Smith
12e9d95b45 add helper method to cleanup isNew test 2011-03-03 17:40:26 -05:00
Matt Smith
4595b48ffb refine the isNew test 2011-03-03 17:35:09 -05:00
Matt Smith
8971361bdc split out test for positive and negative ids 2011-03-03 17:33:19 -05:00
Matt Smith
5ebd949c7f use hash literal directly
This will make it harder to forget to instantiate the model.
2011-03-03 17:20:38 -05:00
Matt Smith
13acb8a822 fix documentation and tests for negative ids
The documentation said that a model was considered new if it had a negative id.
The test had the right message, but failed to instantiate the model the for the second assertion, and the assertion was inverted.
2011-03-03 17:06:16 -05:00
Raimonds Simanovskis
5a89ed3272 destroy of non-persisted model should not call sync 2011-02-15 15:17:20 +02:00
Jeremy Ashkenas
4489d7f5f1 Merging in a test for Issue #204 2011-02-07 15:02:20 -05:00
Jeremy Ashkenas
b86d3f6afc Issue #209 ... unsetting a missing attribute should not fire a change event. 2011-02-07 14:16:31 -05:00
Jeremy Ashkenas
1a9404cfe8 Initial support for models with non-default id attribute names (MongoDB, CouchDB). Various tickets. 2011-02-07 13:59:52 -05:00
Jeremy Ashkenas
ec6842009c Merging in #167, unsetting 'id' 2011-02-07 10:34:42 -05:00
Jeremy Ashkenas
39cabb8ac8 Merge branch 'master' of github.com:documentcloud/backbone 2011-01-11 12:58:23 -05:00
Jeremy Ashkenas
289d4e0066 Model::escape() now coerces non-string (non-falsy) values to strings before escaping them. 2011-01-11 12:58:15 -05:00
Samuel Clay
440d1415fb Fixing a small bug in model inheritance: Class properties need to be inherited (along with the instance properties). See test. 2011-01-05 16:35:05 -05:00
Jeremy Ashkenas
331cb8bede Allowing Model#defaults to be a function as well as a hash. 2010-12-20 23:00:51 -05:00
Jeremy Ashkenas
53ae5b5cdf Issue #132 ... initial _changed after new with attributes. 2010-12-10 11:58:41 -05:00
Jeremy Ashkenas
e8be47f28b merge mkelley's urlBase, renamed to urlRoot. 2010-12-10 10:32:52 -05:00
Jeremy Ashkenas
03aa12a683 Merge branch 'master' of https://github.com/mkelly12/backbone 2010-12-10 10:31:50 -05:00
Jeremy Ashkenas
0c1bbbcc97 Adding Model#has to Backbone... 2010-12-08 12:23:17 -05:00
Matt Todd
21a3675db9 Implement model.is() for attr test, with docs, tests 2010-12-07 02:45:34 -05:00
Jeremy Ashkenas
bbcf19684c A silent change to a model will now make hasChanged() return true ... Issue #105 2010-12-03 09:54:27 -05:00
Matt
524901083e Add urlBase option to model to allow specifying restful url without using a collection 2010-12-02 14:23:13 -08:00
Jeremy Ashkenas
d4dc736a82 adding a bit more of a test for changedattributes. 2010-12-02 09:47:12 -05:00
Jeremy Ashkenas
fa9a4c879d Passing through the options argument to 'change' events. 2010-11-30 15:35:43 -05:00
Jeremy Ashkenas
7ae0384120 first draft of Model#escape 2010-11-29 12:58:47 -05:00
Matt
57194beffa Fix recursion error when saving from within a change event. 2010-11-22 20:49:33 -08:00
Jeremy Ashkenas
f3e961da08 Issue #80. Adding default attributes to Backbone.Model 2010-11-22 14:22:21 -05:00
Jeremy Ashkenas
11dcf246c7 Using a save join() for the default implementation of Model#url 2010-11-16 17:36:53 -05:00
Jeremy Ashkenas
be37cf0178 passing silent: true now suppresses validations. Issue #52 2010-11-08 15:21:54 -05:00
Jeremy Ashkenas
9a74dbc9c3 Make protoProps optional, when inheriting. 2010-11-06 09:48:56 -04:00
Jeremy Ashkenas
65c52763d3 fixing more model.collection in initialize. 2010-11-04 23:52:21 -04:00
Jeremy Ashkenas
ece51d2383 Allowing a collection to be passed into a model via the options. 2010-11-04 23:45:48 -04:00
Raimonds Simanovskis
771b87f17c added options argument to Backbone.Model initialize function 2010-11-03 18:28:40 +02:00
Jeremy Ashkenas
b4d573c943 Merging in Chris Lloyd's Model#clear. Making validations run, if defined, on Model#clear and Model#unset 2010-11-01 11:43:05 -04:00
Jeremy Ashkenas
f0ecfcd279 Issue #44 -- Model#set, empty string vs null. 2010-11-01 10:26:44 -04:00
Jeremy Ashkenas
f0f7c8d5e3 Adding an error when URLs are left unspecified, and highlighting the importance of the URL property in the docs for persistence to work. 2010-10-19 10:47:40 -04:00
Jeremy Ashkenas
a09bcbca9d error events are now always passed the model as the first argument. You may now also pass an error callback to set() and save(), if the callback is passed, it will be called instead of the 'error' event getting fired. 2010-10-19 10:13:50 -04:00
Jeremy Ashkenas
17d64e0a51 Adding Backbone.Model#fetch 2010-10-18 21:31:27 -04:00
Jeremy Ashkenas
7721f8481c adding Backbone.emulateHttp for frameworks that don't support HTTP. Issue #11 2010-10-17 10:53:40 -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
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
317c99be10 attributes is now a public property, uncloned. documenting comparator, and more. 2010-10-13 00:37:02 -04:00