mongo_mapper 0.15.1 → 0.15.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -7
  3. data/lib/mongo_mapper/document.rb +1 -0
  4. data/lib/mongo_mapper/extensions/array.rb +1 -1
  5. data/lib/mongo_mapper/extensions/binary.rb +1 -1
  6. data/lib/mongo_mapper/extensions/date.rb +1 -1
  7. data/lib/mongo_mapper/extensions/float.rb +1 -1
  8. data/lib/mongo_mapper/extensions/hash.rb +1 -1
  9. data/lib/mongo_mapper/extensions/nil_class.rb +2 -2
  10. data/lib/mongo_mapper/extensions/object.rb +1 -1
  11. data/lib/mongo_mapper/extensions/object_id.rb +1 -1
  12. data/lib/mongo_mapper/extensions/set.rb +1 -1
  13. data/lib/mongo_mapper/extensions/string.rb +1 -1
  14. data/lib/mongo_mapper/plugins/associations/many_association.rb +2 -3
  15. data/lib/mongo_mapper/plugins/associations/{belongs_to_polymorphic_proxy.rb → proxy/belongs_to_polymorphic_proxy.rb} +0 -0
  16. data/lib/mongo_mapper/plugins/associations/{belongs_to_proxy.rb → proxy/belongs_to_proxy.rb} +6 -0
  17. data/lib/mongo_mapper/plugins/associations/proxy/collection.rb +55 -0
  18. data/lib/mongo_mapper/plugins/associations/{embedded_collection.rb → proxy/embedded_collection.rb} +0 -0
  19. data/lib/mongo_mapper/plugins/associations/{in_array_proxy.rb → proxy/in_array_proxy.rb} +0 -0
  20. data/lib/mongo_mapper/plugins/associations/{in_foreign_array_proxy.rb → proxy/in_foreign_array_proxy.rb} +0 -0
  21. data/lib/mongo_mapper/plugins/associations/{many_documents_as_proxy.rb → proxy/many_documents_as_proxy.rb} +0 -0
  22. data/lib/mongo_mapper/plugins/associations/{many_documents_proxy.rb → proxy/many_documents_proxy.rb} +0 -4
  23. data/lib/mongo_mapper/plugins/associations/{many_embedded_polymorphic_proxy.rb → proxy/many_embedded_polymorphic_proxy.rb} +0 -0
  24. data/lib/mongo_mapper/plugins/associations/{many_embedded_proxy.rb → proxy/many_embedded_proxy.rb} +0 -0
  25. data/lib/mongo_mapper/plugins/associations/{many_polymorphic_proxy.rb → proxy/many_polymorphic_proxy.rb} +0 -0
  26. data/lib/mongo_mapper/plugins/associations/{one_as_proxy.rb → proxy/one_as_proxy.rb} +0 -0
  27. data/lib/mongo_mapper/plugins/associations/{one_embedded_polymorphic_proxy.rb → proxy/one_embedded_polymorphic_proxy.rb} +0 -0
  28. data/lib/mongo_mapper/plugins/associations/{one_embedded_proxy.rb → proxy/one_embedded_proxy.rb} +3 -1
  29. data/lib/mongo_mapper/plugins/associations/{one_proxy.rb → proxy/one_proxy.rb} +0 -0
  30. data/lib/mongo_mapper/plugins/associations/{proxy.rb → proxy/proxy.rb} +69 -49
  31. data/lib/mongo_mapper/plugins/associations/single_association.rb +2 -11
  32. data/lib/mongo_mapper/plugins/dirty.rb +2 -2
  33. data/lib/mongo_mapper/plugins/embedded_document.rb +1 -1
  34. data/lib/mongo_mapper/plugins/keys/key.rb +9 -6
  35. data/lib/mongo_mapper/plugins/keys.rb +17 -7
  36. data/lib/mongo_mapper/plugins/querying.rb +2 -2
  37. data/lib/mongo_mapper/plugins/scopes.rb +19 -3
  38. data/lib/mongo_mapper/plugins/shardable.rb +30 -0
  39. data/lib/mongo_mapper/plugins/validations.rb +1 -1
  40. data/lib/mongo_mapper/version.rb +1 -1
  41. data/lib/mongo_mapper.rb +18 -18
  42. data/spec/examples.txt +1718 -1697
  43. data/spec/functional/associations/belongs_to_proxy_spec.rb +33 -0
  44. data/spec/functional/associations/one_embedded_proxy_spec.rb +28 -0
  45. data/spec/functional/associations/one_proxy_spec.rb +11 -1
  46. data/spec/functional/dirty_spec.rb +21 -0
  47. data/spec/functional/dirty_with_callbacks_spec.rb +59 -0
  48. data/spec/functional/keys_spec.rb +13 -0
  49. data/spec/functional/scopes_spec.rb +88 -0
  50. data/spec/functional/shardable_spec.rb +67 -0
  51. data/spec/spec_helper.rb +7 -0
  52. data/spec/unit/associations/proxy_spec.rb +30 -5
  53. data/spec/unit/extensions_spec.rb +9 -3
  54. data/spec/unit/inspect_spec.rb +1 -1
  55. data/spec/unit/key_spec.rb +7 -1
  56. metadata +36 -19
  57. data/lib/mongo_mapper/plugins/associations/collection.rb +0 -29
@@ -269,4 +269,37 @@ describe "BelongsToProxy" do
269
269
  end.should_not raise_error
270
270
  end
271
271
  end
272
+
273
+ context "foreign_key=" do
274
+ it "should reset parent when foreign key is changed" do
275
+ post = @post_class.create!
276
+ comment = @comment_class.create!(post: post)
277
+ another_post = @post_class.create!
278
+
279
+ comment.post.should == post
280
+
281
+ comment.post_id = another_post.id
282
+
283
+ comment.post.should == another_post
284
+
285
+ comment.post_id = nil
286
+
287
+ comment.post.should == nil
288
+ end
289
+
290
+ it "should reset parent when foreign key is changed from nil" do
291
+ post = @post_class.create!
292
+ comment = @comment_class.create!(post: nil)
293
+
294
+ comment.post.should == nil
295
+
296
+ comment.post_id = post.id
297
+
298
+ comment.post.should == post
299
+
300
+ comment.post_id = nil
301
+
302
+ comment.post.should == nil
303
+ end
304
+ end
272
305
  end
@@ -97,4 +97,32 @@ describe "OneEmbeddedProxy" do
97
97
  post.author.address.id.should_not be_nil
98
98
  end
99
99
 
100
+ it "should keep the reference to assigned document" do
101
+ @post_class.one(:author, :class => @author_class)
102
+ post = @post_class.new
103
+ new_author = @author_class.new
104
+ post.author = new_author
105
+ new_author.name = 'Frank'
106
+
107
+ post.author.name.should == 'Frank'
108
+ end
109
+
110
+ it "should update references for parent and root" do
111
+ @post_class.key(:author_name, String)
112
+ @post_class.one(:author, :class => @author_class)
113
+ @post_class.before_save do
114
+ self.author_name = author.name
115
+ end
116
+
117
+ author = @author_class.new
118
+ @post_class.create!(author: author)
119
+ author.save!
120
+
121
+ post = @post_class.create!(author: author)
122
+ post.author.name = 'Frank'
123
+ post.author.save!
124
+
125
+ post.author.name.should == 'Frank'
126
+ post.author_name.should == 'Frank'
127
+ end
100
128
  end
@@ -403,4 +403,14 @@ describe "OneProxy" do
403
403
  article.paper_id.should == @paper.id
404
404
  end
405
405
  end
406
- end
406
+
407
+ it "should keep the reference to assigned document" do
408
+ @post_class.one(:author, :class => @author_class)
409
+ post = @post_class.new
410
+ new_author = @author_class.new
411
+ post.author = new_author
412
+ new_author.name = 'Frank'
413
+
414
+ post.author.name.should == 'Frank'
415
+ end
416
+ end
@@ -280,6 +280,27 @@ describe "Dirty" do
280
280
  end
281
281
  end
282
282
 
283
+ context "Document having Array key with typecast option" do
284
+ before do
285
+ @author_id = BSON::ObjectId.new
286
+ @doc = Doc('Book') { key :author_ids, Array, typecast: "ObjectId" }
287
+ @doc.plugin MongoMapper::Plugins::Dirty
288
+ @book = @doc.create!(author_ids: [@author_id])
289
+ end
290
+
291
+ context "changed" do
292
+ it "should be empty if assigned the same array" do
293
+ @book.author_ids = [@author_id]
294
+ @book.changed.should be_empty
295
+ end
296
+
297
+ it "should be empty if assigned the same but before-typecasted array" do
298
+ @book.author_ids = [@author_id.to_s]
299
+ @book.changed.should be_empty
300
+ end
301
+ end
302
+ end
303
+
283
304
  context "Embedded documents" do
284
305
  before do
285
306
  @edoc = EDoc('Duck') { key :name, String }
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'DirtyWithCallbacks' do
4
+ it 'should update its changes/previous_changes before after_create/after_update callbacks' do
5
+ history = {}
6
+
7
+ document = Doc {
8
+ key :x, String
9
+
10
+ after_save {
11
+ history[:after_save] = {
12
+ changes: changes,
13
+ previous_changes: previous_changes,
14
+ }
15
+ }
16
+ after_create {
17
+ history[:after_create] = {
18
+ changes: changes,
19
+ previous_changes: previous_changes,
20
+ }
21
+ }
22
+ after_update {
23
+ history[:after_update] = {
24
+ changes: changes,
25
+ previous_changes: previous_changes,
26
+ }
27
+ }
28
+ }
29
+
30
+ d = document.new(x: 'hello')
31
+ d.save
32
+
33
+ history.should == {
34
+ after_save: {
35
+ changes: {},
36
+ previous_changes: {'x' => [nil, 'hello']},
37
+ },
38
+ after_create: {
39
+ changes: {},
40
+ previous_changes: {'x' => [nil, 'hello']},
41
+ },
42
+ }
43
+ history.clear
44
+
45
+ d.x = 'world'
46
+ d.save!
47
+
48
+ history.should == {
49
+ after_save: {
50
+ changes: {},
51
+ previous_changes: {'x' => ['hello', 'world']},
52
+ },
53
+ after_update: {
54
+ changes: {},
55
+ previous_changes: {'x' => ['hello', 'world']},
56
+ },
57
+ }
58
+ end
59
+ end
@@ -352,6 +352,19 @@ describe "Keys" do
352
352
  it 'should remove the key' do
353
353
  DocWithRemovedKey.keys.should_not have_key "_something"
354
354
  end
355
+ end
356
+
357
+ describe "default with no type" do
358
+ it "should work (regression)" do
359
+ doc = Doc do
360
+ key :a_num, default: 0
361
+ end
355
362
 
363
+ instance = doc.new
364
+ instance.a_num.should == 0
365
+
366
+ instance = doc.new(a_num: 10)
367
+ instance.a_num.should == 10
368
+ end
356
369
  end
357
370
  end
@@ -200,6 +200,19 @@ describe "Scopes" do
200
200
  Blog.scopes.keys.map(&:to_s).should =~ %w(by_slug by_title published)
201
201
  end
202
202
  end
203
+
204
+ context 'with predefined class method name' do
205
+ it 'should raise ArgumentError' do
206
+ bad_names = %i(private public protected allocate new name parent superclass reload)
207
+ bad_names.each do |bad_name|
208
+ -> {
209
+ Doc() do
210
+ scope bad_name, -> {}
211
+ end
212
+ }.should raise_error(ArgumentError, /You tried to define a scope named "#{bad_name}"/)
213
+ end
214
+ end
215
+ end
203
216
  end
204
217
 
205
218
  describe "with_scope" do
@@ -434,4 +447,79 @@ describe "Scopes" do
434
447
  @klass.unsent.sorted.all.should == [two_days_ago, one_day_ago]
435
448
  end
436
449
  end
450
+
451
+ describe "thread safety" do
452
+ before do
453
+ @klass = Doc do
454
+ key :name, String
455
+ end
456
+
457
+ @threads = []
458
+ end
459
+
460
+ after do
461
+ @threads.each do |thread|
462
+ thread.kill
463
+ end
464
+ end
465
+
466
+ def make_thread(&block)
467
+ Thread.new(&block).tap do |thread|
468
+ @threads << thread
469
+ end
470
+ end
471
+
472
+ def wait_for_threads!
473
+ @threads.each { |t| t.join }
474
+ end
475
+
476
+ it "should not taint another thread's active scopes" do
477
+ count_active_scopes = nil
478
+ second_thread_run = false
479
+
480
+ make_thread do
481
+ @klass.with_scope(name: 'foo') do
482
+ loop do
483
+ sleep Float::EPSILON
484
+ break if second_thread_run
485
+ end
486
+ end
487
+ end
488
+
489
+ make_thread do
490
+ count_active_scopes = @klass.active_scopes.length
491
+ second_thread_run = true
492
+ end
493
+
494
+ wait_for_threads!
495
+
496
+ count_active_scopes.should == 0
497
+ end
498
+
499
+ it "should not taint another thread's count method" do
500
+ @klass.create!(name: 'foo')
501
+ @klass.create!(name: 'bar')
502
+
503
+ klass_count = nil
504
+ second_thread_run = false
505
+
506
+ make_thread do
507
+ @klass.with_scope(name: 'foo') do
508
+ loop do
509
+ sleep Float::EPSILON
510
+ break if second_thread_run
511
+ end
512
+ end
513
+ end
514
+
515
+ make_thread do
516
+ klass_count = @klass.count
517
+ second_thread_run = true
518
+ end
519
+
520
+ wait_for_threads!
521
+
522
+ klass_count.should == 2
523
+ end
524
+ end
437
525
  end
@@ -0,0 +1,67 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Shardable' do
4
+ let(:sharded_model) {
5
+ Doc do
6
+ key :first_name, String
7
+ key :last_name, String
8
+ shard_key :first_name, :last_name
9
+ end
10
+ }
11
+
12
+ describe 'shard_key_fields' do
13
+ it 'returns declared field names' do
14
+ sharded_model.shard_key_fields.should == ['first_name', 'last_name']
15
+ end
16
+ end
17
+
18
+ describe 'shard_key_filter' do
19
+ context 'new record' do
20
+ let(:document) { sharded_model.new(first_name: 'John', last_name: 'Smith') }
21
+
22
+ it 'returns current values' do
23
+ document.shard_key_filter.should == { 'first_name' => 'John', 'last_name' => 'Smith' }
24
+ end
25
+ end
26
+
27
+ context 'persisted record' do
28
+ let(:document) { sharded_model.create!(first_name: 'John', last_name: 'Smith') }
29
+
30
+ before do
31
+ document.first_name = 'William'
32
+ end
33
+
34
+ it 'returns persisted values' do
35
+ document.shard_key_filter.should == { 'first_name' => 'John', 'last_name' => 'Smith' }
36
+ end
37
+ end
38
+ end
39
+
40
+ context 'creating new document' do
41
+ let(:document) { sharded_model.new(first_name: 'John', last_name: 'Smith') }
42
+
43
+ it 'inserts new document' do
44
+ lambda { document.save! }.should change { sharded_model.count }.by(1)
45
+
46
+ persisted = sharded_model.find(document.id)
47
+ persisted.first_name.should == 'John'
48
+ persisted.last_name.should == 'Smith'
49
+ end
50
+ end
51
+
52
+ context 'updating persisted document' do
53
+ let(:document) { sharded_model.create!(first_name: 'John', last_name: 'Smith') }
54
+
55
+ before do
56
+ document.first_name = 'William'
57
+ end
58
+
59
+ it 'updates persisted document' do
60
+ lambda { document.save! }.should_not change { sharded_model.count }
61
+
62
+ persisted = sharded_model.find(document.id)
63
+ persisted.first_name.should == 'William'
64
+ persisted.last_name.should == 'Smith'
65
+ end
66
+ end
67
+ end
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,13 @@ $:.unshift(File.expand_path('../../lib', __FILE__))
2
2
 
3
3
  require 'rubygems'
4
4
  require 'bundler/setup'
5
+
6
+ # workaround for https://github.com/jruby/jruby/issues/6547
7
+ if RUBY_PLATFORM == 'java'
8
+ require 'i18n/backend'
9
+ require 'i18n/backend/simple'
10
+ end
11
+
5
12
  Bundler.require(:default)
6
13
  require 'fileutils'
7
14
  require 'timecop'
@@ -1,19 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  class FakeNilProxy < MongoMapper::Plugins::Associations::Proxy
4
- def find_target; nil end
4
+ def load_target; @target ||= nil end
5
5
  end
6
6
 
7
7
  class FakeBlankProxy < MongoMapper::Plugins::Associations::Proxy
8
- def find_target; '' end
8
+ def load_target; @target ||= '' end
9
9
  end
10
10
 
11
11
  class FakeNumberProxy < MongoMapper::Plugins::Associations::Proxy
12
- def find_target; 17 end
12
+ def load_target; @target ||= 17 end
13
13
  end
14
14
 
15
15
  class FakeProxy < MongoMapper::Plugins::Associations::Proxy
16
- def find_target; [1, 2] end
16
+ def load_target; @target ||= [1, 2] end
17
17
  end
18
18
 
19
19
  describe "Proxy" do
@@ -32,7 +32,7 @@ describe "Proxy" do
32
32
  end
33
33
 
34
34
  it "should be able to inspect the proxy" do
35
- @proxy.inspect.should == '[1, 2]'
35
+ @proxy.inspect.should == "#<FakeProxy:#{@proxy.object_id} [1, 2]>"
36
36
  end
37
37
 
38
38
  context "nil?" do
@@ -95,5 +95,30 @@ describe "Proxy" do
95
95
  p = Proc.new {|x| x+1}
96
96
  @proxy.send(:collect, &p).should == [2,3]
97
97
  end
98
+
99
+ it "should not respond to private method" do
100
+ @proxy.reload # To load @proxy.target
101
+ @proxy.target.extend(Module.new do
102
+ private
103
+
104
+ def private_foo
105
+ end
106
+ end)
107
+
108
+ lambda { @proxy.private_foo }.should raise_error(NoMethodError, /private method `private_foo' called/)
109
+ end
110
+ end
111
+
112
+ context "hash" do
113
+ it "should return the same value for the same proxy" do
114
+ proxy_a = FakeProxy.new(@owner, @association)
115
+ proxy_b = FakeProxy.new(@owner, @association)
116
+
117
+ proxy_a.hash.should == proxy_b.hash
118
+ end
119
+
120
+ it "should return different values for different proxies" do
121
+ @proxy.hash.should_not == @nil_proxy.hash
122
+ end
98
123
  end
99
124
  end
@@ -192,15 +192,21 @@ describe "Support" do
192
192
  end
193
193
  end
194
194
 
195
- context "NilClass#from_mongo" do
195
+ context "NilClass.from_mongo" do
196
196
  it "should return nil" do
197
- nil.from_mongo(nil).should be_nil
197
+ NilClass.from_mongo(nil).should be_nil
198
+ end
199
+ end
200
+
201
+ context "NilClass.to_mongo" do
202
+ it "should return nil" do
203
+ NilClass.to_mongo(nil).should be_nil
198
204
  end
199
205
  end
200
206
 
201
207
  context "NilClass#to_mongo" do
202
208
  it "should return nil" do
203
- nil.to_mongo(nil).should be_nil
209
+ nil.to_mongo.should be_nil
204
210
  end
205
211
  end
206
212
 
@@ -31,7 +31,7 @@ describe "Inspect" do
31
31
  klass.many :pets, :class => pets
32
32
 
33
33
  doc = klass.new(:pets => [{:name => "Kitten"}])
34
- doc.inspect.should =~ /_id:.*, pets: \[.*_id.*, name: "Kitten".*\]/
34
+ doc.inspect.should =~ /_id:.*, pets: .*\[.*_id.*, name: "Kitten".*\]/
35
35
  end
36
36
 
37
37
  it "should include embedded document" do
@@ -55,6 +55,7 @@ describe "Key" do
55
55
  it "should work with name and options" do
56
56
  key = Key.new(:foo, :required => true)
57
57
  key.name.should == 'foo'
58
+ key.type.should be_nil
58
59
  key.options[:required].should be_truthy
59
60
  end
60
61
 
@@ -111,7 +112,12 @@ describe "Key" do
111
112
  subject { @key }
112
113
 
113
114
  it "should cast each element correctly" do
114
- ids = [BSON::ObjectId.new, BSON::ObjectId.new, BSON::ObjectId.new.to_s, BSON::ObjectId.new.to_s]
115
+ ids = [
116
+ BSON::ObjectId.new,
117
+ BSON::ObjectId.new,
118
+ BSON::ObjectId.new.to_s,
119
+ BSON::ObjectId.new.to_s
120
+ ]
115
121
  subject.set(ids).should == ids.map { |id| ObjectId.to_mongo(id) }
116
122
  end
117
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_mapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.15.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-10-03 00:00:00.000000000 Z
13
+ date: 2022-02-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mongo
@@ -82,6 +82,20 @@ dependencies:
82
82
  - - "~>"
83
83
  - !ruby/object:Gem::Version
84
84
  version: '1.0'
85
+ - !ruby/object:Gem::Dependency
86
+ name: rexml
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ type: :runtime
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
85
99
  description: MongoMapper is a Object-Document Mapper for Ruby and Rails
86
100
  email:
87
101
  - nunemaker@gmail.com
@@ -137,24 +151,24 @@ files:
137
151
  - lib/mongo_mapper/plugins/associations.rb
138
152
  - lib/mongo_mapper/plugins/associations/base.rb
139
153
  - lib/mongo_mapper/plugins/associations/belongs_to_association.rb
140
- - lib/mongo_mapper/plugins/associations/belongs_to_polymorphic_proxy.rb
141
- - lib/mongo_mapper/plugins/associations/belongs_to_proxy.rb
142
- - lib/mongo_mapper/plugins/associations/collection.rb
143
- - lib/mongo_mapper/plugins/associations/embedded_collection.rb
144
- - lib/mongo_mapper/plugins/associations/in_array_proxy.rb
145
- - lib/mongo_mapper/plugins/associations/in_foreign_array_proxy.rb
146
154
  - lib/mongo_mapper/plugins/associations/many_association.rb
147
- - lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
148
- - lib/mongo_mapper/plugins/associations/many_documents_proxy.rb
149
- - lib/mongo_mapper/plugins/associations/many_embedded_polymorphic_proxy.rb
150
- - lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
151
- - lib/mongo_mapper/plugins/associations/many_polymorphic_proxy.rb
152
- - lib/mongo_mapper/plugins/associations/one_as_proxy.rb
153
155
  - lib/mongo_mapper/plugins/associations/one_association.rb
154
- - lib/mongo_mapper/plugins/associations/one_embedded_polymorphic_proxy.rb
155
- - lib/mongo_mapper/plugins/associations/one_embedded_proxy.rb
156
- - lib/mongo_mapper/plugins/associations/one_proxy.rb
157
- - lib/mongo_mapper/plugins/associations/proxy.rb
156
+ - lib/mongo_mapper/plugins/associations/proxy/belongs_to_polymorphic_proxy.rb
157
+ - lib/mongo_mapper/plugins/associations/proxy/belongs_to_proxy.rb
158
+ - lib/mongo_mapper/plugins/associations/proxy/collection.rb
159
+ - lib/mongo_mapper/plugins/associations/proxy/embedded_collection.rb
160
+ - lib/mongo_mapper/plugins/associations/proxy/in_array_proxy.rb
161
+ - lib/mongo_mapper/plugins/associations/proxy/in_foreign_array_proxy.rb
162
+ - lib/mongo_mapper/plugins/associations/proxy/many_documents_as_proxy.rb
163
+ - lib/mongo_mapper/plugins/associations/proxy/many_documents_proxy.rb
164
+ - lib/mongo_mapper/plugins/associations/proxy/many_embedded_polymorphic_proxy.rb
165
+ - lib/mongo_mapper/plugins/associations/proxy/many_embedded_proxy.rb
166
+ - lib/mongo_mapper/plugins/associations/proxy/many_polymorphic_proxy.rb
167
+ - lib/mongo_mapper/plugins/associations/proxy/one_as_proxy.rb
168
+ - lib/mongo_mapper/plugins/associations/proxy/one_embedded_polymorphic_proxy.rb
169
+ - lib/mongo_mapper/plugins/associations/proxy/one_embedded_proxy.rb
170
+ - lib/mongo_mapper/plugins/associations/proxy/one_proxy.rb
171
+ - lib/mongo_mapper/plugins/associations/proxy/proxy.rb
158
172
  - lib/mongo_mapper/plugins/associations/single_association.rb
159
173
  - lib/mongo_mapper/plugins/caching.rb
160
174
  - lib/mongo_mapper/plugins/callbacks.rb
@@ -188,6 +202,7 @@ files:
188
202
  - lib/mongo_mapper/plugins/sci.rb
189
203
  - lib/mongo_mapper/plugins/scopes.rb
190
204
  - lib/mongo_mapper/plugins/serialization.rb
205
+ - lib/mongo_mapper/plugins/shardable.rb
191
206
  - lib/mongo_mapper/plugins/stats.rb
192
207
  - lib/mongo_mapper/plugins/strong_parameters.rb
193
208
  - lib/mongo_mapper/plugins/timestamps.rb
@@ -224,6 +239,7 @@ files:
224
239
  - spec/functional/callbacks_spec.rb
225
240
  - spec/functional/counter_cache_spec.rb
226
241
  - spec/functional/dirty_spec.rb
242
+ - spec/functional/dirty_with_callbacks_spec.rb
227
243
  - spec/functional/document_spec.rb
228
244
  - spec/functional/dumpable_spec.rb
229
245
  - spec/functional/dynamic_querying_spec.rb
@@ -243,6 +259,7 @@ files:
243
259
  - spec/functional/safe_spec.rb
244
260
  - spec/functional/sci_spec.rb
245
261
  - spec/functional/scopes_spec.rb
262
+ - spec/functional/shardable_spec.rb
246
263
  - spec/functional/static_keys_spec.rb
247
264
  - spec/functional/stats_spec.rb
248
265
  - spec/functional/strong_parameters_spec.rb
@@ -303,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
303
320
  - !ruby/object:Gem::Version
304
321
  version: '0'
305
322
  requirements: []
306
- rubygems_version: 3.1.4
323
+ rubygems_version: 3.1.6
307
324
  signing_key:
308
325
  specification_version: 4
309
326
  summary: A Ruby Object Mapper for Mongo
@@ -1,29 +0,0 @@
1
- # encoding: UTF-8
2
- module MongoMapper
3
- module Plugins
4
- module Associations
5
- class Collection < Proxy
6
- def to_ary
7
- load_target
8
- if target.is_a?(Array)
9
- target.to_ary
10
- else
11
- Array(target)
12
- end
13
- end
14
-
15
- alias_method :to_a, :to_ary
16
-
17
- def include?(*args)
18
- load_target
19
- target.include?(*args)
20
- end
21
-
22
- def reset
23
- super
24
- target = []
25
- end
26
- end
27
- end
28
- end
29
- end