dm-accepts_nested_attributes_for 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. data/CHANGELOG +970 -0
  2. data/Gemfile +84 -0
  3. data/LICENSE +20 -0
  4. data/README.textile +94 -0
  5. data/Rakefile +25 -0
  6. data/TODO +6 -0
  7. data/VERSION +1 -0
  8. data/dm-accepts_nested_attributes.gemspec +114 -0
  9. data/lib/dm-accepts_nested_attributes.rb +13 -0
  10. data/lib/dm-accepts_nested_attributes/model.rb +144 -0
  11. data/lib/dm-accepts_nested_attributes/relationship.rb +82 -0
  12. data/lib/dm-accepts_nested_attributes/resource.rb +382 -0
  13. data/lib/dm-accepts_nested_attributes/version.rb +7 -0
  14. data/spec/accepts_nested_attributes_for_spec.rb +408 -0
  15. data/spec/assign_nested_attributes_for_spec.rb +101 -0
  16. data/spec/comb/1-1_disjoint_spec.rb +67 -0
  17. data/spec/comb/1-1_overlapping_spec.rb +66 -0
  18. data/spec/comb/1-1_subset_spec.rb +65 -0
  19. data/spec/comb/1-1_superset_spec.rb +67 -0
  20. data/spec/comb/1-m_disjoint_spec.rb +71 -0
  21. data/spec/comb/1-m_overlapping_spec.rb +70 -0
  22. data/spec/comb/1-m_subset_spec.rb +65 -0
  23. data/spec/comb/1-m_superset_spec.rb +71 -0
  24. data/spec/comb/m-1_disjoint_spec.rb +71 -0
  25. data/spec/comb/m-1_overlapping_spec.rb +70 -0
  26. data/spec/comb/m-1_subset_spec.rb +65 -0
  27. data/spec/comb/m-1_superset_spec.rb +71 -0
  28. data/spec/comb/n-m_composite_spec.rb +141 -0
  29. data/spec/comb/n-m_surrogate_spec.rb +154 -0
  30. data/spec/many_to_many_composite_spec.rb +120 -0
  31. data/spec/many_to_many_spec.rb +129 -0
  32. data/spec/many_to_one_composite_spec.rb +120 -0
  33. data/spec/many_to_one_spec.rb +101 -0
  34. data/spec/one_to_many_composite_spec.rb +120 -0
  35. data/spec/one_to_many_spec.rb +100 -0
  36. data/spec/one_to_one_composite_spec.rb +150 -0
  37. data/spec/one_to_one_spec.rb +115 -0
  38. data/spec/rcov.opts +6 -0
  39. data/spec/resource_spec.rb +65 -0
  40. data/spec/shared/many_to_many_composite_spec.rb +149 -0
  41. data/spec/shared/many_to_many_spec.rb +146 -0
  42. data/spec/shared/many_to_one_composite_spec.rb +160 -0
  43. data/spec/shared/many_to_one_spec.rb +130 -0
  44. data/spec/shared/one_to_many_composite_spec.rb +159 -0
  45. data/spec/shared/one_to_many_spec.rb +107 -0
  46. data/spec/shared/one_to_one_composite_spec.rb +114 -0
  47. data/spec/shared/one_to_one_spec.rb +111 -0
  48. data/spec/spec.opts +4 -0
  49. data/spec/spec_helper.rb +50 -0
  50. data/spec/update_dirty_spec.rb +113 -0
  51. data/spec/update_multiple_spec.rb +79 -0
  52. data/tasks/changelog.rake +20 -0
  53. data/tasks/ci.rake +1 -0
  54. data/tasks/local_gemfile.rake +18 -0
  55. data/tasks/spec.rake +22 -0
  56. data/tasks/yard.rake +9 -0
  57. data/tasks/yardstick.rake +19 -0
  58. metadata +216 -0
@@ -0,0 +1,970 @@
1
+ [47b2757 | Thu Dec 03 13:42:02 UTC 2009] snusnu <gamsnjaga@gmail.com>
2
+
3
+ * Use jeweler, add standard dm-more tasks and bump to 0.12.0
4
+
5
+ [2a08a89 | Mon Nov 23 16:46:40 UTC 2009] snusnu <gamsnjaga@gmail.com>
6
+
7
+ * Simplified require statements
8
+
9
+ [e24cefe | Mon Nov 23 16:53:50 UTC 2009] snusnu <gamsnjaga@gmail.com>
10
+
11
+ * Use :required => true instead of :nullable => false
12
+
13
+ This means that dm-accepts_nested_attributes now
14
+ depends on dm-core >= 0.10.2
15
+
16
+ [4c30792 | Mon Sep 21 17:06:53 UTC 2009] snusnu <gamsnjaga@gmail.com>
17
+
18
+ * Fixed error message in case no appropriate relationship was found
19
+
20
+ [41f43e8 | Thu Sep 17 12:19:11 UTC 2009] snusnu <gamsnjaga@gmail.com>
21
+
22
+ * Simplified code doesn't depend on class_inheritable_reader
23
+
24
+ This means that dana is now usable inside modules,
25
+ which is necessary for proper dm-is-remixable suppport
26
+ and my dm-is-localizable plugin in particular.
27
+
28
+ [95041df | Sat Sep 12 20:02:37 UTC 2009] snusnu <gamsnjaga@gmail.com>
29
+
30
+ * Removed current limitations section from README
31
+
32
+ This no longer applies.
33
+
34
+ [780f8a0 | Sat Sep 12 14:15:05 UTC 2009] snusnu <gamsnjaga@gmail.com>
35
+
36
+ * Refactored to support ruby 1.9
37
+
38
+ This should fix the following error that was
39
+ previously thrown on ruby 1.9.1
40
+
41
+ implicit argument passing of super from method
42
+ defined by define_method is not supported
43
+
44
+ Also, it really should have been this way from
45
+ the beginning. Using define_method was completely
46
+ unnecessary.
47
+
48
+ [95ab6bf | Thu Sep 03 15:42:08 UTC 2009] snusnu <gamsnjaga@gmail.com>
49
+
50
+ * Finally, all specs pass!
51
+
52
+ * I'm not really pleased with the way it works now
53
+ though. If anyone has better suggestions, I'd be
54
+ glad to hear them.
55
+
56
+ [503e6d9 | Wed Sep 02 13:00:56 UTC 2009] snusnu <gamsnjaga@gmail.com>
57
+
58
+ * Removed now unnecessary workaround
59
+
60
+ [f47516a | Fri Aug 28 15:22:56 UTC 2009] snusnu <gamsnjaga@gmail.com>
61
+
62
+ * Destroying m:n now works, 1:1 and 1:n don't :)
63
+
64
+ * Getting weird can't modify frozen object errors
65
+ in has_1_spec and has_n_spec when running specs
66
+ for destroy.
67
+
68
+ [07122e4 | Fri Aug 28 15:20:24 UTC 2009] snusnu <gamsnjaga@gmail.com>
69
+
70
+ * Allow dm-constraints to migrate the constraints
71
+
72
+ [e0d017a | Wed Aug 05 17:21:45 UTC 2009] snusnu <gamsnjaga@gmail.com>
73
+
74
+ * Strip whitespace
75
+
76
+ [19d1871 | Wed Aug 05 17:13:16 UTC 2009] snusnu <gamsnjaga@gmail.com>
77
+
78
+ * Support STI scenarios
79
+
80
+ * Previously, calling accepts_nested_attributes_for
81
+ on an STI subclass resulted in errors because
82
+ options_for_nested_attributes wasn't inherited.
83
+
84
+ * Hopefully this commit fixes that. No specs to prove
85
+ that though, so far.
86
+
87
+ [d36e7ee | Wed Aug 05 17:11:15 UTC 2009] snusnu <gamsnjaga@gmail.com>
88
+
89
+ * Enable 'rake spec' without errors saying dm-core can't be found
90
+
91
+ * However, rake spec still yields weird transaction errors like
92
+
93
+ Lock wait timeout exceeded; try restarting transaction
94
+
95
+ [1d51f5b | Tue Aug 04 13:08:41 UTC 2009] snusnu <gamsnjaga@gmail.com>
96
+
97
+ * Bumped version
98
+
99
+ [2fa2de4 | Mon Aug 03 07:53:51 UTC 2009] Angel N. Sciortino <contact@angeliccomputing.com>
100
+
101
+ * update operations now perform validations too
102
+
103
+ * This is achieved by calling resource.attributes = ...
104
+ followed by resource.save under the hood.
105
+
106
+ * Once Resource#update calls Resource#save inside dm-core
107
+ this shouldn't be necessary anymore (but wouldn't hurt
108
+ either)
109
+
110
+ [286ac11 | Mon Aug 03 18:19:02 UTC 2009] snusnu <gamsnjaga@gmail.com>
111
+
112
+ * Commented currently unspecced relationship declarations
113
+
114
+ * These introduce lots of spec failures because dm-core
115
+ seems to establish not nullable FK properties on the
116
+ target end of the relationship.
117
+
118
+ * For reference, the specs started failing with
119
+ http://is.gd/20SH8
120
+
121
+ [571ba2e | Fri Jul 31 16:20:25 UTC 2009] snusnu <gamsnjaga@gmail.com>
122
+
123
+ * Removed obsolete section from README
124
+
125
+ [9a9bbe1 | Fri Jul 03 14:26:21 UTC 2009] snusnu <gamsnjaga@gmail.com>
126
+
127
+ * spec fixtures for has_1_through and has_n_through with n intermediaries
128
+
129
+ [ae1acfa | Fri Jul 03 13:55:32 UTC 2009] snusnu <gamsnjaga@gmail.com>
130
+
131
+ * added additional spec expectations for nested attribute writers
132
+
133
+ * Added explicit expectations to prove that calling
134
+ nested attribute writers never alters the state
135
+ of the storage engine directly. Persistence will
136
+ only happen when #save is called.
137
+
138
+ [7b0194f | Wed Jul 01 19:41:38 UTC 2009] snusnu <gamsnjaga@gmail.com>
139
+
140
+ * support composite keys when creating new nested resources
141
+
142
+ * refactored the previous constant into it's own method
143
+ to support composite keys and also allow overwriting
144
+
145
+ [a9efa26 | Wed Jul 01 18:45:49 UTC 2009] snusnu <gamsnjaga@gmail.com>
146
+
147
+ * no assumptions on the length of the m:m target collection
148
+
149
+ * Maybe this will never be necessary, but I'm still thinking
150
+ about how this whole #assign_or_mark_for_destruction method
151
+ could be refactored. I don't like the fact the name itself
152
+ already implies that this method has 2 different purposes.
153
+
154
+ [d2e0a9d | Wed Jul 01 18:20:36 UTC 2009] snusnu <gamsnjaga@gmail.com>
155
+
156
+ * fixed renaming regression in #normalize_attributes_collection
157
+
158
+ [34efa0f | Wed Jul 01 18:19:57 UTC 2009] snusnu <gamsnjaga@gmail.com>
159
+
160
+ * don't sort attributes in #normalize_attributes_collection
161
+
162
+ * I can see no real advantage in doing so, let's keep it simple
163
+
164
+ [5a17003 | Wed Jul 01 18:18:11 UTC 2009] snusnu <gamsnjaga@gmail.com>
165
+
166
+ * idiomatic datamapper usage
167
+
168
+ * this changes the spec error to a simple unmet expectation
169
+ compared to an fk violation error before
170
+
171
+ * this is kind of weird, since existing_record is the same
172
+ in both cases
173
+
174
+ [fa4edde | Wed Jul 01 16:46:47 UTC 2009] snusnu <gamsnjaga@gmail.com>
175
+
176
+ * no need to do anything if the m:m target collection is empty
177
+
178
+ [599da7f | Wed Jul 01 16:45:20 UTC 2009] snusnu <gamsnjaga@gmail.com>
179
+
180
+ * don't expect the target_collection to always be of length 1
181
+
182
+ * actually this is the case in the current implementation,
183
+ but that may change, and the code is simpler that way
184
+
185
+ [2ce2b3f | Wed Jul 01 16:40:22 UTC 2009] snusnu <gamsnjaga@gmail.com>
186
+
187
+ * respect composite keys at the target end of m:m relationships
188
+
189
+ [0331a9f | Wed Jul 01 16:05:04 UTC 2009] snusnu <gamsnjaga@gmail.com>
190
+
191
+ * mark the correct resources for destruction in m:m scenario
192
+
193
+ * However, it doesn't work, because the target resource always
194
+ gets destroyed before the intermediaries
195
+
196
+ [a1e8da4 | Mon Jun 29 15:39:19 UTC 2009] snusnu <gamsnjaga@gmail.com>
197
+
198
+ * removed meaningless documentation
199
+
200
+ [a07dcef | Thu Jun 25 03:26:08 UTC 2009] snusnu <gamsnjaga@gmail.com>
201
+
202
+ * added spec that proves that m2m deletion wipes out all intermediaries
203
+
204
+ * this is bad bad behavior and needs to be fixed
205
+
206
+ [c8d21a0 | Thu Jun 25 03:04:20 UTC 2009] snusnu <gamsnjaga@gmail.com>
207
+
208
+ * all specs pass with or without dm-constraints
209
+
210
+ * deleted an invalid spec that expected dm-constraints
211
+ to be present
212
+
213
+ [6913c23 | Thu Jun 25 02:42:13 UTC 2009] snusnu <gamsnjaga@gmail.com>
214
+
215
+ * allow github to build a datamapper 0.10 compatible gem
216
+
217
+ [d6abeb1 | Thu Jun 25 02:39:03 UTC 2009] snusnu <gamsnjaga@gmail.com>
218
+
219
+ * removed rspec tmbundle logger support
220
+
221
+ [bc119f9 | Thu Jun 25 02:34:45 UTC 2009] snusnu <gamsnjaga@gmail.com>
222
+
223
+ * support running specs with or without dm-constraints
224
+
225
+ [84609fb | Thu Jun 25 01:57:03 UTC 2009] snusnu <gamsnjaga@gmail.com>
226
+
227
+ * updated datamapper 0.10.0 compatibility information
228
+
229
+ [bda6fbc | Thu Jun 25 01:53:38 UTC 2009] snusnu <gamsnjaga@gmail.com>
230
+
231
+ * cleaner code for many_to_many deletion
232
+
233
+ * also added TODO note about handling this with
234
+ mark_for_destruction like all the other
235
+ relationship kinds.
236
+
237
+ [bce5322 | Thu Jun 25 00:58:11 UTC 2009] snusnu <gamsnjaga@gmail.com>
238
+
239
+ * support deleting of many_to_many associations (all specs pass)
240
+
241
+ * Deletion is currently triggered when calling the nested
242
+ attribute writer. This is most probably not desired and
243
+ is likely to change.
244
+
245
+ * Example:
246
+
247
+ Person.has(n, :projects, :through => :project_memberships)
248
+ @person.projects_attributes = {
249
+ :id => project.id, :_delete => true
250
+ }
251
+
252
+ This will delete the associated project_membership
253
+ and then the project
254
+
255
+ [a8f2a9a | Wed Jun 24 15:52:48 UTC 2009] snusnu <gamsnjaga@gmail.com>
256
+
257
+ * mark_for_destruction? now really returns true or false (not nil)
258
+
259
+ [8127032 | Wed Jun 24 15:44:27 UTC 2009] snusnu <gamsnjaga@gmail.com>
260
+
261
+ * corrected specs for atomic commits
262
+
263
+ * those specs aren't really shared, but only valid
264
+ for situations with no :reject_if guard that returns
265
+ true.
266
+
267
+ * only 1 spec failing now and that's deleting
268
+ has(n, :through)
269
+
270
+ [226a5a6 | Wed Jun 24 04:00:41 UTC 2009] snusnu <gamsnjaga@gmail.com>
271
+
272
+ * added hopefully last missing documentation
273
+
274
+ [51b5fdb | Wed Jun 24 03:54:41 UTC 2009] snusnu <gamsnjaga@gmail.com>
275
+
276
+ * finished documenting all modules and methods
277
+
278
+ * also fixed a bug where attributes weren't sent
279
+ to the :reject_if guard in case the guard was
280
+ specified as Symbol or String.
281
+
282
+ [faeaf5b | Wed Jun 24 02:05:08 UTC 2009] snusnu <gamsnjaga@gmail.com>
283
+
284
+ * #save_self no overwritten on every resource
285
+
286
+ * this makes more deletion specs pass and is actually
287
+ really obvious. wonder why it took me so long.
288
+
289
+ * still a few atomic commits related specs failing
290
+ but slowly getting there.
291
+
292
+ * also, this needs my current dm-validations work
293
+ available at
294
+ http://github.com/snusnu/dm-more/commits/validation_context_work
295
+
296
+ [2582c12 | Wed Jun 24 02:02:36 UTC 2009] snusnu <gamsnjaga@gmail.com>
297
+
298
+ * docfixes and a minor internal implementation change
299
+
300
+ [097bf9d | Wed Jun 24 02:01:13 UTC 2009] snusnu <gamsnjaga@gmail.com>
301
+
302
+ * minor internal method renaming.
303
+
304
+ * actually, i'm considering refactoring this method
305
+ * i don't like the name, it already indicates that
306
+ this methods serves 2 purposes which isn't good.
307
+
308
+ [5cd44f9 | Wed Jun 24 01:58:52 UTC 2009] snusnu <gamsnjaga@gmail.com>
309
+
310
+ * no need to name useless rest arguments
311
+
312
+ * in fact, it may very well be safe to remove them
313
+ altogether. think more about this.
314
+
315
+ [666ee63 | Wed Jun 24 01:57:56 UTC 2009] snusnu <gamsnjaga@gmail.com>
316
+
317
+ * use mysql in specs since dm-constraints are broken for sqlite3
318
+
319
+ [92d25ff | Wed Jun 24 01:57:37 UTC 2009] snusnu <gamsnjaga@gmail.com>
320
+
321
+ * use dm-constraints in specs for more safety
322
+
323
+ [9c5f2af | Wed Jun 17 16:16:00 UTC 2009] snusnu <gamsnjaga@gmail.com>
324
+
325
+ * updated Manifext.txt and gemspec to reflect the current structure
326
+
327
+ [717d870 | Tue Jun 16 13:17:34 UTC 2009] snusnu <gamsnjaga@gmail.com>
328
+
329
+ * adapted to latest dm-core
330
+
331
+ * still the same specs failing
332
+
333
+ [0ae2f1a | Mon Jun 15 15:02:02 UTC 2009] snusnu <gamsnjaga@gmail.com>
334
+
335
+ * less invasive dm-core overwrite in Resource#save_parents
336
+
337
+ * i don't know if that's the best way, but it works for now
338
+
339
+ [dc188ee | Mon Jun 15 15:01:06 UTC 2009] snusnu <gamsnjaga@gmail.com>
340
+
341
+ * minor spec refactoring to run the shared examples all the time
342
+
343
+ [178c99b | Sat Jun 13 20:20:44 UTC 2009] snusnu <gamsnjaga@gmail.com>
344
+
345
+ * added comments about what goes wrong
346
+
347
+ [9f2279e | Sat Jun 13 18:52:47 UTC 2009] snusnu <gamsnjaga@gmail.com>
348
+
349
+ * styles matter, i like this better
350
+
351
+ [123c70f | Sat Jun 13 18:26:21 UTC 2009] snusnu <gamsnjaga@gmail.com>
352
+
353
+ * refactored shared specs for has(n, :through) associations
354
+
355
+ * factored out real shared behavior and run it from
356
+ all examples
357
+
358
+ * causes 1 failure in "should perform atomic commits"
359
+
360
+ [2393d0d | Sat Jun 13 18:25:57 UTC 2009] snusnu <gamsnjaga@gmail.com>
361
+
362
+ * refactored shared specs for has(n) associations
363
+
364
+ * factored out real shared behavior and run it from
365
+ all examples
366
+
367
+ * causes 1 failure in "should perform atomic commits"
368
+
369
+ [f786acd | Sat Jun 13 18:25:11 UTC 2009] snusnu <gamsnjaga@gmail.com>
370
+
371
+ * refactored shared specs for has(1) associations
372
+
373
+ * factored out real shared behavior and run it from
374
+ all examples
375
+
376
+ * causes 1 failure in "should perform atomic commits"
377
+
378
+ [ad7d968 | Sat Jun 13 17:45:58 UTC 2009] snusnu <gamsnjaga@gmail.com>
379
+
380
+ * refactored shared specs for belongs_to associations
381
+
382
+ * factored out real shared behavior and run it from
383
+ all examples
384
+
385
+ [a14e6fd | Sat Jun 13 16:07:36 UTC 2009] snusnu <gamsnjaga@gmail.com>
386
+
387
+ * made all but 3 specs pass
388
+
389
+ * this means that all specs except those that test
390
+ destroying of an associated resource via the
391
+ nested attribute accessors, works.
392
+
393
+ * TODO this spec change needs more thinking. I'm
394
+ not yet sure if not creating a Person in this case
395
+ is the right behavior.
396
+
397
+ [8de57d1 | Sat Jun 13 16:05:44 UTC 2009] snusnu <gamsnjaga@gmail.com>
398
+
399
+ * adapt overwritten save behavior to latest dm-core changes
400
+
401
+ [e3837fe | Sat Jun 13 16:05:18 UTC 2009] snusnu <gamsnjaga@gmail.com>
402
+
403
+ * don't use chainable in client code
404
+
405
+ * it should be sufficient that dm-core declared
406
+ the method as chainable
407
+
408
+ [4121c57 | Sat Jun 13 16:04:26 UTC 2009] snusnu <gamsnjaga@gmail.com>
409
+
410
+ * removed debug statements
411
+
412
+ [80b9774 | Fri Jun 12 20:59:12 UTC 2009] snusnu <gamsnjaga@gmail.com>
413
+
414
+ * added debug statements
415
+
416
+ [3d316f8 | Fri Jun 12 20:58:56 UTC 2009] snusnu <gamsnjaga@gmail.com>
417
+
418
+ * specs now explicitly assign related resources to the association
419
+
420
+ [04a87ad | Thu Jun 04 15:44:20 UTC 2009] snusnu <gamsnjaga@gmail.com>
421
+
422
+ * removed unneeded assertions
423
+
424
+ * deleting a related resource still not working
425
+ * transactions still not working
426
+
427
+ * other than that, it seems quite fine
428
+
429
+ [6a2e07f | Tue Jun 02 20:17:56 UTC 2009] snusnu <gamsnjaga@gmail.com>
430
+
431
+ * include save behavior only if a resource accepts nested attributes
432
+
433
+ [d2c27c6 | Tue Jun 02 19:59:41 UTC 2009] snusnu <gamsnjaga@gmail.com>
434
+
435
+ * spec formatting and useless assertion removal
436
+
437
+ [5f8d0e1 | Tue Jun 02 19:39:28 UTC 2009] snusnu <gamsnjaga@gmail.com>
438
+
439
+ * added a few TODO and FIXME comments
440
+
441
+ [a317852 | Tue Jun 02 19:05:20 UTC 2009] snusnu <gamsnjaga@gmail.com>
442
+
443
+ * moved shared specs to spec/shared directory.
444
+
445
+ * this reduces clutter from the main specs
446
+ * also it will hopefully help with refactoring
447
+ the specs to provide better shared specs that
448
+ can be used for all integrations specs
449
+
450
+ [3ab51dc | Tue Jun 02 18:24:23 UTC 2009] snusnu <gamsnjaga@gmail.com>
451
+
452
+ * moved rspec_tmbundle_support to spec/lib
453
+
454
+ [3579f97 | Tue Jun 02 18:19:03 UTC 2009] snusnu <gamsnjaga@gmail.com>
455
+
456
+ * formatting and some assertion changes for belongs_to specs
457
+
458
+ [7752b87 | Tue Jun 02 18:06:08 UTC 2009] snusnu <gamsnjaga@gmail.com>
459
+
460
+ * nice formatting for spec fixtures.
461
+
462
+ [4c18a35 | Tue Jun 02 17:55:25 UTC 2009] snusnu <gamsnjaga@gmail.com>
463
+
464
+ * use parent saving behavior for *all* resources.
465
+
466
+ * breaks lots of specs that were already passing
467
+ * i don't know why this is, but nevertheless i think
468
+ that this is probably the way to go.
469
+
470
+ [653f615 | Tue Jun 02 17:33:15 UTC 2009] snusnu <gamsnjaga@gmail.com>
471
+
472
+ * disabled mark_for_destruction for now
473
+
474
+ [15a5174 | Thu May 28 18:06:23 UTC 2009] snusnu <gamsnjaga@gmail.com>
475
+
476
+ * docs for the resource extensions
477
+
478
+ [22dea73 | Thu May 28 17:40:55 UTC 2009] snusnu <gamsnjaga@gmail.com>
479
+
480
+ * more docs for the model extensions
481
+
482
+ [a109f10 | Thu May 28 16:19:29 UTC 2009] snusnu <gamsnjaga@gmail.com>
483
+
484
+ * allow deletion of many_to_one target via generated writer
485
+
486
+ * this makes all belongs_to_specs pass, however it doesn't
487
+ work for has_1_specs.
488
+
489
+ * before this changeset, both belongs_to and has_1 failed
490
+ at the same spec (deleting the related resource). i wonder
491
+ why that is ...
492
+
493
+ [81eda71 | Thu May 28 16:16:50 UTC 2009] snusnu <gamsnjaga@gmail.com>
494
+
495
+ * docs for one method to have yard style in place
496
+
497
+ [b50b192 | Thu May 28 16:01:00 UTC 2009] snusnu <gamsnjaga@gmail.com>
498
+
499
+ * added a few TODO notes
500
+
501
+ [8652a89 | Thu May 28 16:00:49 UTC 2009] snusnu <gamsnjaga@gmail.com>
502
+
503
+ * readability ftw
504
+
505
+ [89d02cf | Thu May 28 14:52:14 UTC 2009] snusnu <gamsnjaga@gmail.com>
506
+
507
+ * better names for internal methods
508
+
509
+ * accepts_nested_attributes_for_relationship_to_#{type}
510
+ is now
511
+ accepts_nested_attributes_for_related_#{type}
512
+
513
+ [04e39ed | Thu May 28 14:41:03 UTC 2009] snusnu <gamsnjaga@gmail.com>
514
+
515
+ * fixed reject_new_record guards (gone bad while refactoring)
516
+
517
+ * belongs_to and has_1 specs only have 1 failure
518
+ related to deleting the record
519
+
520
+ * TODO: find out why mark_as_destruction doesn't
521
+ do the right thing when called from #save
522
+
523
+ [7052c72 | Thu May 28 14:39:23 UTC 2009] snusnu <gamsnjaga@gmail.com>
524
+
525
+ * removed comment in shared spec that doesn't apply to every usage
526
+
527
+ [8479ee6 | Thu May 28 13:32:39 UTC 2009] snusnu <gamsnjaga@gmail.com>
528
+
529
+ * fixed nested_attributes reader (gone bad in the refactoring)
530
+
531
+ [b72f510 | Thu May 28 13:16:24 UTC 2009] snusnu <gamsnjaga@gmail.com>
532
+
533
+ * better formatting for save methods
534
+
535
+ [d8535cc | Thu May 28 13:05:05 UTC 2009] snusnu <gamsnjaga@gmail.com>
536
+
537
+ * changed internal method name convention
538
+
539
+ * accepts_nested_attributes_for_#{type}_relationship
540
+ is now
541
+ accepts_nested_attributes_for_relationship_to_#{type}
542
+
543
+ [1fdf6b5 | Thu May 28 12:37:35 UTC 2009] snusnu <gamsnjaga@gmail.com>
544
+
545
+ * rspec_tmbundle_support now uses Extlib::Logger
546
+
547
+ * DataMapper::Logger is now Extlib::Logger
548
+
549
+ [a2d4f4e | Thu May 28 04:29:58 UTC 2009] snusnu <gamsnjaga@gmail.com>
550
+
551
+ * removed resource_spec from Manifest and gemspec
552
+
553
+ [2e89d38 | Thu May 28 04:29:29 UTC 2009] snusnu <gamsnjaga@gmail.com>
554
+
555
+ * no need to expect explicitly ordered spec files
556
+
557
+ [76c06a3 | Thu May 28 04:28:53 UTC 2009] snusnu <gamsnjaga@gmail.com>
558
+
559
+ * i guess whitespace isn't necessary there
560
+
561
+ [0e309e1 | Thu May 28 04:16:56 UTC 2009] snusnu <gamsnjaga@gmail.com>
562
+
563
+ * bypass needless calls to association_name all the time
564
+
565
+ * key options_for_nested_attributes by relationship
566
+ instead of association_name. this eliminates the
567
+ need to repeatedly fetch the relationship by its
568
+ name and provides more concise codes in general.
569
+
570
+ * removed the relationship method since it's not
571
+ needed anymore
572
+
573
+ * removed the reject_new_nested_attributes_guard_for
574
+ method since it's not needed anymore
575
+
576
+ * number of passing specs is still the same
577
+
578
+ [dd859c3 | Thu May 28 04:12:44 UTC 2009] snusnu <gamsnjaga@gmail.com>
579
+
580
+ * include save_or_destroy in save, no need to separate it
581
+
582
+ [fdd29b0 | Thu May 28 02:36:01 UTC 2009] snusnu <gamsnjaga@gmail.com>
583
+
584
+ * removed dead meaningless parameters
585
+
586
+ * also, let the code speak for itself if it can.
587
+ in this case, the comments didn't offer any
588
+ additional value
589
+
590
+ [da8747c | Thu May 28 02:23:00 UTC 2009] snusnu <gamsnjaga@gmail.com>
591
+
592
+ * typo
593
+
594
+ [8c6a061 | Thu May 28 02:22:16 UTC 2009] snusnu <gamsnjaga@gmail.com>
595
+
596
+ * methods should have a single task
597
+
598
+ * don't validate the association_name inside
599
+ assert_valid_options_for_nested_attributes
600
+
601
+ [da2d474 | Thu May 28 02:21:15 UTC 2009] snusnu <gamsnjaga@gmail.com>
602
+
603
+ * explicitly include plugin functionality
604
+
605
+ * don't alter existing datamapper api by simply
606
+ requiring files. instead, do it explicitly as
607
+ this also serves a documentation puropose since
608
+ it's more obvious what's going on.
609
+
610
+ [ae50006 | Wed May 27 23:31:47 UTC 2009] snusnu <gamsnjaga@gmail.com>
611
+
612
+ * every case statement wants an else branch
613
+
614
+ * although the plugin will guarantee not to enter
615
+ this code path, who knows what people try to do.
616
+ it's a (private) method, so someone could use
617
+ it in a possibly wrong way so why not inform
618
+ him/her if that happens.
619
+
620
+ * also, i think that the use of 'next' instead of
621
+ deeply nested if/unless/case reads nicer
622
+
623
+ [38ece56 | Wed May 27 23:17:36 UTC 2009] snusnu <gamsnjaga@gmail.com>
624
+
625
+ * avoid mutating parameters when it's not necessary
626
+
627
+ [38225d6 | Wed May 27 23:15:32 UTC 2009] snusnu <gamsnjaga@gmail.com>
628
+
629
+ * made normalize_attributes_collection self contained
630
+
631
+ [b42cf92 | Wed May 27 21:50:16 UTC 2009] snusnu <gamsnjaga@gmail.com>
632
+
633
+ * removed specs for ':reject_if => :foo' for now
634
+
635
+ * added a TODO note to remind me to add them back again,
636
+ once i have decided where to best put them.
637
+
638
+ [57ccf94 | Wed May 27 21:41:59 UTC 2009] snusnu <gamsnjaga@gmail.com>
639
+
640
+ * check proper exception class in specs
641
+
642
+ [6fa76ee | Wed May 27 21:11:54 UTC 2009] snusnu <gamsnjaga@gmail.com>
643
+
644
+ * replaced meaningless specs with one that makes sense
645
+
646
+ [361a5d1 | Wed May 27 21:01:04 UTC 2009] snusnu <gamsnjaga@gmail.com>
647
+
648
+ * don't use bang! methods when not appropriate.
649
+
650
+ * see http://is.gd/HqLo for a detailed explanation
651
+
652
+ [4e8014b | Wed May 27 20:52:07 UTC 2009] snusnu <gamsnjaga@gmail.com>
653
+
654
+ * extracted method mainly for documentation purposes
655
+
656
+ [5e22497 | Wed May 27 20:51:04 UTC 2009] snusnu <gamsnjaga@gmail.com>
657
+
658
+ * replaced explicitly defined helper with dm-core api access
659
+
660
+ [e981ce6 | Wed May 27 19:10:46 UTC 2009] snusnu <gamsnjaga@gmail.com>
661
+
662
+ * cleaned up weird condition syntax
663
+
664
+ [9a6318c | Wed May 27 19:10:20 UTC 2009] snusnu <gamsnjaga@gmail.com>
665
+
666
+ * better usage of RelationshipAccess
667
+
668
+ * it's not necessary to call relationship! from
669
+ inside accepts_nested_attributes_for.
670
+ The association_name is *definitely* valid at
671
+ this time.
672
+
673
+ [6e8c49f | Wed May 27 18:20:47 UTC 2009] snusnu <gamsnjaga@gmail.com>
674
+
675
+ * model extension now less invasive and easier to extend
676
+
677
+ * Added relationship/relationship! methods to
678
+ provide a cleaner interface to the relationships
679
+ defined on a model. This hides the implementation
680
+ detail that relationships are stored in a hash
681
+ which is bound to change anyway. Also, it allows
682
+ to *fail fast* when trying to access a relationship
683
+ that is not defined in a model (via relationship!)
684
+
685
+ * restructured the files to better encapsulate and
686
+ communicate what's in them.
687
+
688
+ * better use of dm-core methods allowed previously
689
+ explicitly declared methods to be removed.
690
+
691
+ [5084804 | Tue May 26 18:55:12 UTC 2009] snusnu <gamsnjaga@gmail.com>
692
+
693
+ * imported dkubb's version of Resource#save for dana
694
+
695
+ * unit specs all pass
696
+ * belongs_to specs pass except for deletion (not yet integrated)
697
+ * all has_x specs still have failures
698
+
699
+ [44fd13d | Fri May 22 20:52:53 UTC 2009] snusnu <gamsnjaga@gmail.com>
700
+
701
+ * having serious troubles trying to get 0.10.0 to work :-(
702
+
703
+ [aed8d1e | Wed May 20 02:53:32 UTC 2009] snusnu <gamsnjaga@gmail.com>
704
+
705
+ * NOT compatible with datamapper 0.10.0
706
+
707
+ * a list of errors when running unmodified specs:
708
+
709
+ uninitialized constant
710
+ DataMapper::Associations::RelationshipChain
711
+
712
+ undefined method `transaction'
713
+ for #<Person @id=nil @name="snusnu"
714
+
715
+ undefined local variable or method `create'
716
+ for #<Person @id=nil @name="Martin">
717
+ (probably extlib related?)
718
+
719
+ The property 'name' is not accessible in Profile
720
+ (probably transaction related)
721
+
722
+ [eecfa47 | Wed May 20 02:45:48 UTC 2009] snusnu <gamsnjaga@gmail.com>
723
+
724
+ * updated version to 0.10.0
725
+
726
+ [55d6029 | Wed May 20 02:40:51 UTC 2009] snusnu <gamsnjaga@gmail.com>
727
+
728
+ * removed usage of rubygems
729
+
730
+ [9ae06e1 | Wed May 20 02:40:39 UTC 2009] snusnu <gamsnjaga@gmail.com>
731
+
732
+ * upgraded datamapper dependencies to 0.10.0
733
+
734
+ [b704849 | Wed May 13 04:30:18 UTC 2009] snusnu <gamsnjaga@gmail.com>
735
+
736
+ * updated CHANGELOG
737
+
738
+ [b621475 | Wed May 13 04:29:30 UTC 2009] snusnu <gamsnjaga@gmail.com>
739
+
740
+ * bumped version to 0.0.6.
741
+
742
+ [91923dd | Wed May 13 04:18:49 UTC 2009] snusnu <gamsnjaga@gmail.com>
743
+
744
+ * respect dm-is-remixable (thx Asher Van Brunt for pointing this out)
745
+
746
+ Since class_inheritable_accessor is not available on Module, dana
747
+ bailed out for dm-is-remixable. This should hopefully fix this issue.
748
+
749
+ [ef8e1ca | Mon May 11 00:17:43 UTC 2009] snusnu <gamsnjaga@gmail.com>
750
+
751
+ * added CHANGELOG rake task and file (taken from manveru/ramaze)
752
+
753
+ [52c55bc | Wed Apr 29 04:50:32 UTC 2009] snusnu <gamsnjaga@gmail.com>
754
+
755
+ * bump tiny version for extlib/hook compatible gem.
756
+
757
+ [c34edae | Wed Apr 29 04:46:43 UTC 2009] snusnu <gamsnjaga@gmail.com>
758
+
759
+ * now compatible with extlib/hook. (last commit was missing files)
760
+
761
+ [8e42229 | Wed Apr 29 04:34:20 UTC 2009] snusnu <gamsnjaga@gmail.com>
762
+
763
+ * workaround extlib/hook not respecting hooked but redefined methods.
764
+
765
+ [578e658 | Wed Apr 29 02:46:56 UTC 2009] snusnu <gamsnjaga@gmail.com>
766
+
767
+ * only alter common DataMapper namespace if really necessary.
768
+
769
+ [7da8378 | Wed Apr 29 01:41:07 UTC 2009] snusnu <gamsnjaga@gmail.com>
770
+
771
+ * less brittle specs with no more auto_migrations before(:each)
772
+
773
+ [f2a2fcb | Wed Apr 29 01:38:00 UTC 2009] snusnu <gamsnjaga@gmail.com>
774
+
775
+ * updated Manifest and gemspec to reflect spec cleanings
776
+
777
+ [dd0a4a8 | Fri Apr 24 17:29:41 UTC 2009] snusnu <gamsnjaga@gmail.com>
778
+
779
+ * removed fixtures and specs for customized has(n, :through) associations.
780
+
781
+ It makes no sense to spec all different options for the association
782
+ macros in integration specs. Rather, it should be specced once and
783
+ for all (in unit specs) that dm-accepts_nested_attributes infers the
784
+ right kind of associations. Think about it, then do it!
785
+
786
+ [ac7c008 | Fri Apr 24 17:27:12 UTC 2009] snusnu <gamsnjaga@gmail.com>
787
+
788
+ * be explicit about before(:each)
789
+
790
+ [7a56d17 | Fri Apr 24 17:26:35 UTC 2009] snusnu <gamsnjaga@gmail.com>
791
+
792
+ * removed commented code
793
+
794
+ [03bc5c2 | Fri Apr 24 17:25:25 UTC 2009] snusnu <gamsnjaga@gmail.com>
795
+
796
+ * don't auto_migrate! before(:each) spec run (takes half the time)
797
+
798
+ [b6f5bf5 | Tue Apr 21 14:52:22 UTC 2009] snusnu <gamsnjaga@gmail.com>
799
+
800
+ * removed debugging outputs
801
+
802
+ [001c791 | Sat Apr 18 14:31:35 UTC 2009] snusnu <gamsnjaga@gmail.com>
803
+
804
+ * added red specs for transactions. make them green.
805
+
806
+ [9852f03 | Sat Apr 18 03:07:04 UTC 2009] snusnu <gamsnjaga@gmail.com>
807
+
808
+ * formatting
809
+
810
+ [3fceda3 | Sat Apr 18 02:34:54 UTC 2009] snusnu <gamsnjaga@gmail.com>
811
+
812
+ * no need to require gem dependencies in spec_helper.rb
813
+
814
+ [2118726 | Wed Apr 15 18:57:22 UTC 2009] snusnu <gamsnjaga@gmail.com>
815
+
816
+ * initial support for wrapping every save inside a transaction.
817
+
818
+ * this probably needs more thinking, also funny is that specs if
819
+ called from textmate rspec bundle all pass, whereas when called
820
+ from the shell, some of them (only has(1)) break.
821
+ investigate this
822
+ * dbussink also suggested it might be a good idea to add an option
823
+ that allows to turn transaction usage off.
824
+ * also, look for some api to infer wether a backend supports
825
+ (nested) transactions or not. we could default to true if it does,
826
+ but still leave the option to turn it off nevertheless.
827
+
828
+ [abdc211 | Wed Apr 15 14:18:07 UTC 2009] snusnu <gamsnjaga@gmail.com>
829
+
830
+ * added sanitize_nested_attributes to provide a hook for doing this.
831
+
832
+ * see http://is.gd/sz2d for the motivation behind this new method
833
+
834
+ [158b6ea | Wed Apr 15 02:50:38 UTC 2009] snusnu <gamsnjaga@gmail.com>
835
+
836
+ * fixed broken generated gemspec. find out why this happens.
837
+
838
+ [5603c57 | Wed Apr 15 02:49:54 UTC 2009] snusnu <gamsnjaga@gmail.com>
839
+
840
+ * updated manifest to include new specs from integration branch
841
+
842
+ [4c5e656 | Tue Apr 14 18:25:02 UTC 2009] Rupert Voelcker <rupert@rupespad.com>
843
+
844
+ * added #{association_name}_attributes reader
845
+
846
+ Signed-off-by: Martin Gamsjaeger <gamsnjaga@gmail.com>
847
+
848
+ [6d26213 | Tue Apr 14 03:09:34 UTC 2009] Rupert Voelcker <rupert@rupespad.com>
849
+
850
+ * added associated attributes reader (doesn't do anything yet)
851
+
852
+ Signed-off-by: Martin Gamsjaeger <gamsnjaga@gmail.com>
853
+
854
+ [32dcfe8 | Wed Apr 15 02:20:00 UTC 2009] snusnu <gamsnjaga@gmail.com>
855
+
856
+ * initial support for dm-validations
857
+
858
+ * this desperately needs specs! currently only basic not null
859
+ constraint specs pass (well, there are no other).
860
+ * saving a resource along with its associations should always
861
+ be done inside a transaction! figure out how to do that!
862
+ * validation errors from associated resources should be copied
863
+ to the parent resource. this currently happens, but it's not
864
+ specced at all so consider the behavior undefined.
865
+
866
+ [fef1578 | Wed Apr 15 01:37:14 UTC 2009] snusnu <gamsnjaga@gmail.com>
867
+
868
+ * initialize dm logger before setting up dm adapter
869
+
870
+ [8d7ede8 | Wed Apr 15 01:35:50 UTC 2009] snusnu <gamsnjaga@gmail.com>
871
+
872
+ * allow to call puth helper like puts without parameter
873
+
874
+ [4e204a1 | Tue Apr 14 01:19:30 UTC 2009] Rupert Voelcker <rupert@rupespad.com>
875
+
876
+ * now works with 'renamed' has many relationships
877
+
878
+ Signed-off-by: Martin Gamsjaeger <gamsnjaga@gmail.com>
879
+
880
+ [8f20aad | Mon Apr 13 00:33:40 UTC 2009] snusnu <gamsnjaga@gmail.com>
881
+
882
+ * build that gem\!
883
+
884
+ [cc02415 | Sun Apr 12 22:57:26 UTC 2009] snusnu <gamsnjaga@gmail.com>
885
+
886
+ * updated manifest
887
+
888
+ [d0f0dce | Sun Apr 12 22:57:08 UTC 2009] snusnu <gamsnjaga@gmail.com>
889
+
890
+ * use constants from Rakefile in tasks/install
891
+
892
+ [b45ea52 | Fri Apr 10 16:12:11 UTC 2009] snusnu <gamsnjaga@gmail.com>
893
+
894
+ * added get_#{association_name} helper for (many/one)_to_one associations.
895
+
896
+ This is mainly to support common usecases in fields_for. This method
897
+ will return a new record if the associated object is nil at the time
898
+ it is accessed, and the associated object otherwise. This should help
899
+ fields_for to render the right id and name attributes for the input
900
+ fields. This method is not generated for (one/many)_to_many associations
901
+ since these return an Collection anyway and this allow to call build
902
+ or get on it. A possible use case would look something like this:
903
+
904
+ <% fields_for @location.get_geo_point do %>
905
+ ...
906
+ <% end =%>
907
+
908
+ The whole purpose of this commit is to provide something to fields_for
909
+ that is guaranteed to not be nil.
910
+
911
+ [8acb396 | Fri Apr 10 02:28:48 UTC 2009] snusnu <gamsnjaga@gmail.com>
912
+
913
+ * no .rb extension in require statements
914
+
915
+ [bd6dfe6 | Fri Apr 10 01:52:45 UTC 2009] snusnu <gamsnjaga@gmail.com>
916
+
917
+ * added passing specs for reject_if procs
918
+
919
+ [2a1d309 | Thu Apr 09 19:55:52 UTC 2009] snusnu <gamsnjaga@gmail.com>
920
+
921
+ * updated README
922
+
923
+ [b0fcf44 | Thu Apr 09 19:52:14 UTC 2009] snusnu <gamsnjaga@gmail.com>
924
+
925
+ * update now works for has(n, :through) -> all works now
926
+
927
+ [a8ba5f6 | Thu Apr 09 19:44:48 UTC 2009] snusnu <gamsnjaga@gmail.com>
928
+
929
+ * destroy now works for has(n, :through)
930
+
931
+ [2b5d583 | Thu Apr 09 19:11:35 UTC 2009] snusnu <gamsnjaga@gmail.com>
932
+
933
+ * explain what's going on when creating a new has(n, :through) child entry
934
+
935
+ [b8a4be4 | Thu Apr 09 18:59:44 UTC 2009] snusnu <gamsnjaga@gmail.com>
936
+
937
+ * updated README to reflect latest changes
938
+
939
+ [1efbb4c | Thu Apr 09 18:56:27 UTC 2009] snusnu <gamsnjaga@gmail.com>
940
+
941
+ * create now works for has(n, :through)
942
+
943
+ [71d3d73 | Thu Apr 09 16:07:41 UTC 2009] snusnu <gamsnjaga@gmail.com>
944
+
945
+ * added a few spec helpers
946
+
947
+ [2783be5 | Thu Apr 09 03:06:59 UTC 2009] snusnu <gamsnjaga@gmail.com>
948
+
949
+ * more robust (backwards compatible) monkeypatch.
950
+
951
+ [c49516e | Thu Apr 09 01:42:23 UTC 2009] snusnu <gamsnjaga@gmail.com>
952
+
953
+ * README cosmetics
954
+
955
+ [974d7b5 | Thu Apr 09 01:38:01 UTC 2009] snusnu <gamsnjaga@gmail.com>
956
+
957
+ * Updated README to reflect the latest status.
958
+
959
+ [69eb9ff | Thu Apr 09 01:28:10 UTC 2009] snusnu <gamsnjaga@gmail.com>
960
+
961
+ * reworked association saving. all except has(n,:through) work now
962
+
963
+ [1200617 | Wed Apr 08 18:57:58 UTC 2009] snusnu <gamsnjaga@gmail.com>
964
+
965
+ * really minor README cosmetics
966
+
967
+ [bda2607 | Wed Apr 08 17:44:34 UTC 2009] snusnu <gamsnjaga@gmail.com>
968
+
969
+ * Push it
970
+