tenacity 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/history.txt CHANGED
@@ -1,3 +1,11 @@
1
+ == 0.5.4
2
+
3
+ * Bug fixes
4
+
5
+ * Fixed a bug that was causing the associate objects in a _t_has_many association
6
+ to be wiped out when saving an object that had not yet loaded the
7
+ associated objects from the database.
8
+
1
9
  == 0.5.3
2
10
 
3
11
  * Bug fixes
@@ -95,6 +95,12 @@ module Tenacity
95
95
  def _t_save_associates(record, association)
96
96
  return if record.perform_save_associates_callback == false
97
97
 
98
+ loaded_associations = record.instance_variable_get('@_t_loaded_associations')
99
+ if record.instance_variable_get(record._t_ivar_name(association)).nil? &&
100
+ (loaded_associations.nil? || loaded_associations[association].nil?)
101
+ return
102
+ end
103
+
98
104
  old_associates = get_current_associates(record, association)
99
105
 
100
106
  # Some ORM libraries (CouchRest, ActiveRecord, etc) return a proxy in
@@ -70,6 +70,9 @@ module Tenacity
70
70
  if value.nil? || force_reload
71
71
  value = create_proxy(yield, association)
72
72
  instance_variable_set _t_ivar_name(association), value
73
+
74
+ @_t_loaded_associations ||= {}
75
+ @_t_loaded_associations[association] = true
73
76
  end
74
77
  value
75
78
  end
@@ -1,3 +1,3 @@
1
1
  module Tenacity
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
@@ -152,6 +152,13 @@ class HasManyTest < Test::Unit::TestCase
152
152
  assert_set_equal ['ActiveRecordEngine', 'ActiveRecordEngine', 'ActiveRecordEngine'], components.map {|c| c.diagnosable_type}
153
153
  end
154
154
 
155
+ should "not lose the associated objects when the main object is updated" do
156
+ car = ActiveRecordCar.find(@car.id)
157
+ car.update_attributes(:prop => "abc123")
158
+ assert_equal @wheels, ActiveRecordCar.find(car.id).mongo_mapper_wheels
159
+ assert_equal "abc123", ActiveRecordCar.find(car.id).prop
160
+ end
161
+
155
162
  context "with an a active t_belongs_to association that is not auto destroyed" do
156
163
  setup do
157
164
  @car = ActiveRecordCar.create
metadata CHANGED
@@ -1,352 +1,244 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: tenacity
3
- version: !ruby/object:Gem::Version
4
- hash: 13
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.4
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 5
9
- - 3
10
- version: 0.5.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - John Wood
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-11-18 00:00:00 -06:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2011-12-11 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: activesupport
23
- prerelease: false
24
- type: :runtime
25
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2166742780 !ruby/object:Gem::Requirement
26
17
  none: false
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- hash: 5
31
- segments:
32
- - 2
33
- - 3
34
- version: "2.3"
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: bundler
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '2.3'
22
+ type: :runtime
38
23
  prerelease: false
39
- type: :development
40
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *2166742780
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &2166741660 !ruby/object:Gem::Requirement
41
28
  none: false
42
- requirements:
29
+ requirements:
43
30
  - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 23
46
- segments:
47
- - 1
48
- - 0
49
- - 0
31
+ - !ruby/object:Gem::Version
50
32
  version: 1.0.0
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: rake
54
- prerelease: false
55
33
  type: :development
56
- requirement: &id003 !ruby/object:Gem::Requirement
34
+ prerelease: false
35
+ version_requirements: *2166741660
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ requirement: &2166740640 !ruby/object:Gem::Requirement
57
39
  none: false
58
- requirements:
40
+ requirements:
59
41
  - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 49
62
- segments:
63
- - 0
64
- - 8
65
- - 7
42
+ - !ruby/object:Gem::Version
66
43
  version: 0.8.7
67
- version_requirements: *id003
68
- - !ruby/object:Gem::Dependency
69
- name: rcov
70
- prerelease: false
71
44
  type: :development
72
- requirement: &id004 !ruby/object:Gem::Requirement
45
+ prerelease: false
46
+ version_requirements: *2166740640
47
+ - !ruby/object:Gem::Dependency
48
+ name: rcov
49
+ requirement: &2166740020 !ruby/object:Gem::Requirement
73
50
  none: false
74
- requirements:
51
+ requirements:
75
52
  - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 41
78
- segments:
79
- - 0
80
- - 9
81
- - 9
53
+ - !ruby/object:Gem::Version
82
54
  version: 0.9.9
83
- version_requirements: *id004
84
- - !ruby/object:Gem::Dependency
85
- name: shoulda
86
- prerelease: false
87
55
  type: :development
88
- requirement: &id005 !ruby/object:Gem::Requirement
56
+ prerelease: false
57
+ version_requirements: *2166740020
58
+ - !ruby/object:Gem::Dependency
59
+ name: shoulda
60
+ requirement: &2166739380 !ruby/object:Gem::Requirement
89
61
  none: false
90
- requirements:
62
+ requirements:
91
63
  - - ~>
92
- - !ruby/object:Gem::Version
93
- hash: 37
94
- segments:
95
- - 2
96
- - 11
97
- - 3
64
+ - !ruby/object:Gem::Version
98
65
  version: 2.11.3
99
- version_requirements: *id005
100
- - !ruby/object:Gem::Dependency
101
- name: mocha
102
- prerelease: false
103
66
  type: :development
104
- requirement: &id006 !ruby/object:Gem::Requirement
67
+ prerelease: false
68
+ version_requirements: *2166739380
69
+ - !ruby/object:Gem::Dependency
70
+ name: mocha
71
+ requirement: &2166738740 !ruby/object:Gem::Requirement
105
72
  none: false
106
- requirements:
73
+ requirements:
107
74
  - - ~>
108
- - !ruby/object:Gem::Version
109
- hash: 47
110
- segments:
111
- - 0
112
- - 9
113
- - 10
75
+ - !ruby/object:Gem::Version
114
76
  version: 0.9.10
115
- version_requirements: *id006
116
- - !ruby/object:Gem::Dependency
117
- name: yard
118
- prerelease: false
119
77
  type: :development
120
- requirement: &id007 !ruby/object:Gem::Requirement
78
+ prerelease: false
79
+ version_requirements: *2166738740
80
+ - !ruby/object:Gem::Dependency
81
+ name: yard
82
+ requirement: &2166738120 !ruby/object:Gem::Requirement
121
83
  none: false
122
- requirements:
84
+ requirements:
123
85
  - - ~>
124
- - !ruby/object:Gem::Version
125
- hash: 15
126
- segments:
127
- - 0
128
- - 6
129
- - 4
86
+ - !ruby/object:Gem::Version
130
87
  version: 0.6.4
131
- version_requirements: *id007
132
- - !ruby/object:Gem::Dependency
133
- name: sqlite3-ruby
134
- prerelease: false
135
88
  type: :development
136
- requirement: &id008 !ruby/object:Gem::Requirement
89
+ prerelease: false
90
+ version_requirements: *2166738120
91
+ - !ruby/object:Gem::Dependency
92
+ name: sqlite3-ruby
93
+ requirement: &2166737440 !ruby/object:Gem::Requirement
137
94
  none: false
138
- requirements:
95
+ requirements:
139
96
  - - ~>
140
- - !ruby/object:Gem::Version
141
- hash: 25
142
- segments:
143
- - 1
144
- - 3
145
- - 1
97
+ - !ruby/object:Gem::Version
146
98
  version: 1.3.1
147
- version_requirements: *id008
148
- - !ruby/object:Gem::Dependency
149
- name: activerecord
150
- prerelease: false
151
99
  type: :development
152
- requirement: &id009 !ruby/object:Gem::Requirement
100
+ prerelease: false
101
+ version_requirements: *2166737440
102
+ - !ruby/object:Gem::Dependency
103
+ name: activerecord
104
+ requirement: &2166736600 !ruby/object:Gem::Requirement
153
105
  none: false
154
- requirements:
106
+ requirements:
155
107
  - - ~>
156
- - !ruby/object:Gem::Version
157
- hash: 7
158
- segments:
159
- - 3
160
- - 0
161
- - 0
108
+ - !ruby/object:Gem::Version
162
109
  version: 3.0.0
163
- version_requirements: *id009
164
- - !ruby/object:Gem::Dependency
165
- name: datamapper
166
- prerelease: false
167
110
  type: :development
168
- requirement: &id010 !ruby/object:Gem::Requirement
111
+ prerelease: false
112
+ version_requirements: *2166736600
113
+ - !ruby/object:Gem::Dependency
114
+ name: datamapper
115
+ requirement: &2166731420 !ruby/object:Gem::Requirement
169
116
  none: false
170
- requirements:
117
+ requirements:
171
118
  - - ~>
172
- - !ruby/object:Gem::Version
173
- hash: 19
174
- segments:
175
- - 1
176
- - 0
177
- - 2
119
+ - !ruby/object:Gem::Version
178
120
  version: 1.0.2
179
- version_requirements: *id010
180
- - !ruby/object:Gem::Dependency
181
- name: dm-sqlite-adapter
182
- prerelease: false
183
121
  type: :development
184
- requirement: &id011 !ruby/object:Gem::Requirement
122
+ prerelease: false
123
+ version_requirements: *2166731420
124
+ - !ruby/object:Gem::Dependency
125
+ name: dm-sqlite-adapter
126
+ requirement: &2166728920 !ruby/object:Gem::Requirement
185
127
  none: false
186
- requirements:
128
+ requirements:
187
129
  - - ~>
188
- - !ruby/object:Gem::Version
189
- hash: 19
190
- segments:
191
- - 1
192
- - 0
193
- - 2
130
+ - !ruby/object:Gem::Version
194
131
  version: 1.0.2
195
- version_requirements: *id011
196
- - !ruby/object:Gem::Dependency
197
- name: sequel
198
- prerelease: false
199
132
  type: :development
200
- requirement: &id012 !ruby/object:Gem::Requirement
133
+ prerelease: false
134
+ version_requirements: *2166728920
135
+ - !ruby/object:Gem::Dependency
136
+ name: sequel
137
+ requirement: &2166728280 !ruby/object:Gem::Requirement
201
138
  none: false
202
- requirements:
139
+ requirements:
203
140
  - - ~>
204
- - !ruby/object:Gem::Version
205
- hash: 75
206
- segments:
207
- - 3
208
- - 19
209
- - 0
141
+ - !ruby/object:Gem::Version
210
142
  version: 3.19.0
211
- version_requirements: *id012
212
- - !ruby/object:Gem::Dependency
213
- name: mongo_mapper
214
- prerelease: false
215
143
  type: :development
216
- requirement: &id013 !ruby/object:Gem::Requirement
144
+ prerelease: false
145
+ version_requirements: *2166728280
146
+ - !ruby/object:Gem::Dependency
147
+ name: mongo_mapper
148
+ requirement: &2166727680 !ruby/object:Gem::Requirement
217
149
  none: false
218
- requirements:
150
+ requirements:
219
151
  - - ~>
220
- - !ruby/object:Gem::Version
221
- hash: 59
222
- segments:
223
- - 0
224
- - 9
225
- - 0
152
+ - !ruby/object:Gem::Version
226
153
  version: 0.9.0
227
- version_requirements: *id013
228
- - !ruby/object:Gem::Dependency
229
- name: bson_ext
230
- prerelease: false
231
154
  type: :development
232
- requirement: &id014 !ruby/object:Gem::Requirement
155
+ prerelease: false
156
+ version_requirements: *2166727680
157
+ - !ruby/object:Gem::Dependency
158
+ name: bson_ext
159
+ requirement: &2166727060 !ruby/object:Gem::Requirement
233
160
  none: false
234
- requirements:
161
+ requirements:
235
162
  - - ~>
236
- - !ruby/object:Gem::Version
237
- hash: 27
238
- segments:
239
- - 1
240
- - 3
241
- - 0
163
+ - !ruby/object:Gem::Version
242
164
  version: 1.3.0
243
- version_requirements: *id014
244
- - !ruby/object:Gem::Dependency
245
- name: mongoid
246
- prerelease: false
247
165
  type: :development
248
- requirement: &id015 !ruby/object:Gem::Requirement
166
+ prerelease: false
167
+ version_requirements: *2166727060
168
+ - !ruby/object:Gem::Dependency
169
+ name: mongoid
170
+ requirement: &2166726400 !ruby/object:Gem::Requirement
249
171
  none: false
250
- requirements:
172
+ requirements:
251
173
  - - ~>
252
- - !ruby/object:Gem::Version
253
- hash: 15
254
- segments:
255
- - 2
256
- - 0
257
- - 0
174
+ - !ruby/object:Gem::Version
258
175
  version: 2.0.0
259
- version_requirements: *id015
260
- - !ruby/object:Gem::Dependency
261
- name: couchrest
262
- prerelease: false
263
176
  type: :development
264
- requirement: &id016 !ruby/object:Gem::Requirement
177
+ prerelease: false
178
+ version_requirements: *2166726400
179
+ - !ruby/object:Gem::Dependency
180
+ name: couchrest
181
+ requirement: &2166725820 !ruby/object:Gem::Requirement
265
182
  none: false
266
- requirements:
183
+ requirements:
267
184
  - - ~>
268
- - !ruby/object:Gem::Version
269
- hash: 23
270
- segments:
271
- - 1
272
- - 0
273
- - 0
185
+ - !ruby/object:Gem::Version
274
186
  version: 1.0.0
275
- version_requirements: *id016
276
- - !ruby/object:Gem::Dependency
277
- name: couchrest_model
278
- prerelease: false
279
187
  type: :development
280
- requirement: &id017 !ruby/object:Gem::Requirement
188
+ prerelease: false
189
+ version_requirements: *2166725820
190
+ - !ruby/object:Gem::Dependency
191
+ name: couchrest_model
192
+ requirement: &2166725080 !ruby/object:Gem::Requirement
281
193
  none: false
282
- requirements:
194
+ requirements:
283
195
  - - ~>
284
- - !ruby/object:Gem::Version
285
- hash: 23
286
- segments:
287
- - 1
288
- - 0
289
- - 0
196
+ - !ruby/object:Gem::Version
290
197
  version: 1.0.0
291
- version_requirements: *id017
292
- - !ruby/object:Gem::Dependency
293
- name: ripple
294
- prerelease: false
295
198
  type: :development
296
- requirement: &id018 !ruby/object:Gem::Requirement
199
+ prerelease: false
200
+ version_requirements: *2166725080
201
+ - !ruby/object:Gem::Dependency
202
+ name: ripple
203
+ requirement: &2166724480 !ruby/object:Gem::Requirement
297
204
  none: false
298
- requirements:
205
+ requirements:
299
206
  - - ~>
300
- - !ruby/object:Gem::Version
301
- hash: 63
302
- segments:
303
- - 0
304
- - 9
305
- - 2
207
+ - !ruby/object:Gem::Version
306
208
  version: 0.9.2
307
- version_requirements: *id018
308
- - !ruby/object:Gem::Dependency
309
- name: toystore
310
- prerelease: false
311
209
  type: :development
312
- requirement: &id019 !ruby/object:Gem::Requirement
210
+ prerelease: false
211
+ version_requirements: *2166724480
212
+ - !ruby/object:Gem::Dependency
213
+ name: toystore
214
+ requirement: &2166723920 !ruby/object:Gem::Requirement
313
215
  none: false
314
- requirements:
216
+ requirements:
315
217
  - - ~>
316
- - !ruby/object:Gem::Version
317
- hash: 63
318
- segments:
319
- - 0
320
- - 8
321
- - 0
218
+ - !ruby/object:Gem::Version
322
219
  version: 0.8.0
323
- version_requirements: *id019
324
- - !ruby/object:Gem::Dependency
325
- name: adapter-mongo
326
- prerelease: false
327
220
  type: :development
328
- requirement: &id020 !ruby/object:Gem::Requirement
221
+ prerelease: false
222
+ version_requirements: *2166723920
223
+ - !ruby/object:Gem::Dependency
224
+ name: adapter-mongo
225
+ requirement: &2166721320 !ruby/object:Gem::Requirement
329
226
  none: false
330
- requirements:
227
+ requirements:
331
228
  - - ~>
332
- - !ruby/object:Gem::Version
333
- hash: 15
334
- segments:
335
- - 0
336
- - 5
337
- - 2
229
+ - !ruby/object:Gem::Version
338
230
  version: 0.5.2
339
- version_requirements: *id020
340
- description: Tenacity provides a database client independent way of specifying simple relationships between models backed by different databases.
341
- email:
231
+ type: :development
232
+ prerelease: false
233
+ version_requirements: *2166721320
234
+ description: Tenacity provides a database client independent way of specifying simple
235
+ relationships between models backed by different databases.
236
+ email:
342
237
  - john@johnpwood.net
343
238
  executables: []
344
-
345
239
  extensions: []
346
-
347
240
  extra_rdoc_files: []
348
-
349
- files:
241
+ files:
350
242
  - .gitignore
351
243
  - EXTEND.rdoc
352
244
  - Gemfile
@@ -446,41 +338,33 @@ files:
446
338
  - test/orm_ext/sequel_test.rb
447
339
  - test/orm_ext/toystore_test.rb
448
340
  - test/test_helper.rb
449
- has_rdoc: true
450
341
  homepage: http://github.com/jwood/tenacity
451
- licenses:
342
+ licenses:
452
343
  - MIT
453
344
  post_install_message:
454
345
  rdoc_options: []
455
-
456
- require_paths:
346
+ require_paths:
457
347
  - lib
458
- required_ruby_version: !ruby/object:Gem::Requirement
348
+ required_ruby_version: !ruby/object:Gem::Requirement
459
349
  none: false
460
- requirements:
461
- - - ">="
462
- - !ruby/object:Gem::Version
463
- hash: 3
464
- segments:
350
+ requirements:
351
+ - - ! '>='
352
+ - !ruby/object:Gem::Version
353
+ version: '0'
354
+ segments:
465
355
  - 0
466
- version: "0"
467
- required_rubygems_version: !ruby/object:Gem::Requirement
356
+ hash: 2735830648188006742
357
+ required_rubygems_version: !ruby/object:Gem::Requirement
468
358
  none: false
469
- requirements:
470
- - - ">="
471
- - !ruby/object:Gem::Version
472
- hash: 23
473
- segments:
474
- - 1
475
- - 3
476
- - 6
359
+ requirements:
360
+ - - ! '>='
361
+ - !ruby/object:Gem::Version
477
362
  version: 1.3.6
478
363
  requirements: []
479
-
480
364
  rubyforge_project: tenacity
481
- rubygems_version: 1.6.0
365
+ rubygems_version: 1.8.10
482
366
  signing_key:
483
367
  specification_version: 3
484
- summary: A database client independent way of specifying simple relationships between models backed by different databases.
368
+ summary: A database client independent way of specifying simple relationships between
369
+ models backed by different databases.
485
370
  test_files: []
486
-