mongoid 9.0.1 → 9.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/lib/config/locales/en.yml +16 -0
  3. data/lib/mongoid/association/accessors.rb +7 -2
  4. data/lib/mongoid/association/nested/one.rb +14 -1
  5. data/lib/mongoid/association/referenced/belongs_to/binding.rb +7 -1
  6. data/lib/mongoid/association/referenced/belongs_to/buildable.rb +1 -1
  7. data/lib/mongoid/association/referenced/belongs_to.rb +15 -0
  8. data/lib/mongoid/association/referenced/has_many.rb +9 -8
  9. data/lib/mongoid/association/referenced/has_one/buildable.rb +3 -8
  10. data/lib/mongoid/association/referenced/with_polymorphic_criteria.rb +41 -0
  11. data/lib/mongoid/attributes/nested.rb +2 -1
  12. data/lib/mongoid/clients/options.rb +14 -1
  13. data/lib/mongoid/clients/sessions.rb +13 -15
  14. data/lib/mongoid/composable.rb +2 -0
  15. data/lib/mongoid/document.rb +2 -0
  16. data/lib/mongoid/errors/unrecognized_model_alias.rb +53 -0
  17. data/lib/mongoid/errors/unrecognized_resolver.rb +27 -0
  18. data/lib/mongoid/errors/unregistered_class.rb +47 -0
  19. data/lib/mongoid/errors.rb +3 -0
  20. data/lib/mongoid/identifiable.rb +28 -0
  21. data/lib/mongoid/matcher.rb +15 -1
  22. data/lib/mongoid/model_resolver.rb +154 -0
  23. data/lib/mongoid/persistence_context.rb +15 -9
  24. data/lib/mongoid/railties/controller_runtime.rb +2 -2
  25. data/lib/mongoid/serializable.rb +7 -7
  26. data/lib/mongoid/threaded.rb +96 -28
  27. data/lib/mongoid/timestamps/timeless.rb +4 -1
  28. data/lib/mongoid/touchable.rb +1 -1
  29. data/lib/mongoid/traversable.rb +11 -2
  30. data/lib/mongoid/validatable/associated.rb +5 -2
  31. data/lib/mongoid/version.rb +1 -1
  32. data/spec/integration/active_job_spec.rb +24 -20
  33. data/spec/integration/app_spec.rb +9 -1
  34. data/spec/integration/associations/belongs_to_spec.rb +129 -0
  35. data/spec/integration/persistence/collection_options_spec.rb +36 -0
  36. data/spec/mongoid/association/embedded/embeds_many_query_spec.rb +4 -0
  37. data/spec/mongoid/association/referenced/belongs_to/proxy_spec.rb +5 -0
  38. data/spec/mongoid/association/referenced/belongs_to_spec.rb +58 -21
  39. data/spec/mongoid/association/referenced/has_many/buildable_spec.rb +4 -0
  40. data/spec/mongoid/attributes/nested_spec.rb +1 -0
  41. data/spec/mongoid/clients/options_spec.rb +127 -2
  42. data/spec/mongoid/clients/transactions_spec.rb +2 -2
  43. data/spec/mongoid/interceptable_spec.rb +12 -0
  44. data/spec/mongoid/interceptable_spec_models.rb +12 -0
  45. data/spec/mongoid/model_resolver_spec.rb +167 -0
  46. data/spec/mongoid/monkey_patches_spec.rb +1 -1
  47. data/spec/mongoid/persistence_context_spec.rb +48 -4
  48. data/spec/mongoid/railties/bson_object_id_serializer_spec.rb +18 -12
  49. data/spec/mongoid/serializable_spec.rb +16 -9
  50. data/spec/mongoid/threaded_spec.rb +24 -5
  51. data/spec/mongoid/validatable/associated_spec.rb +14 -4
  52. data/spec/rails/controller_extension/controller_runtime_spec.rb +14 -14
  53. metadata +14 -4
@@ -0,0 +1,167 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'support/feature_sandbox'
5
+
6
+ MONGOID_MODEL_RESOLVER_KEY__ = :__separate_instance_spec_key
7
+ Mongoid::ModelResolver.register_resolver Mongoid::ModelResolver.new, MONGOID_MODEL_RESOLVER_KEY__
8
+
9
+ def quarantine(context, &block)
10
+ state = {}
11
+
12
+ context.before(:context) do
13
+ state[:quarantine] = FeatureSandbox.start_quarantine
14
+ block&.call
15
+ end
16
+
17
+ context.after(:context) do
18
+ FeatureSandbox.end_quarantine(state[:quarantine])
19
+ end
20
+ end
21
+
22
+ describe Mongoid::ModelResolver do
23
+ shared_examples 'a resolver' do |**kwargs|
24
+ it 'includes the class name when asked for all keys of the given model' do
25
+ expect(resolver.keys_for(model_class.new)).to include(model_class.name)
26
+ end
27
+
28
+ if kwargs[:with_aliases].nil?
29
+ it 'uses the class name as the default key for the given model' do
30
+ expect(resolver.default_key_for(model_class.new)).to eq model_class.name
31
+ end
32
+ elsif kwargs[:with_aliases].is_a?(Array)
33
+ it 'uses the first alias as the default key for the given model' do
34
+ expect(resolver.default_key_for(model_class.new)).to eq kwargs[:with_aliases].first
35
+ end
36
+ else
37
+ it 'uses the alias as the default key for the given model' do
38
+ expect(resolver.default_key_for(model_class.new)).to eq kwargs[:with_aliases]
39
+ end
40
+ end
41
+
42
+ it 'returns the model class when queried with the class name' do
43
+ expect(resolver.model_for(model_class.name)).to eq model_class
44
+ end
45
+
46
+ Array(kwargs[:with_aliases]).each do |model_alias|
47
+ it "includes the alias #{model_alias.inspect} when asked for all keys of the given model" do
48
+ expect(resolver.keys_for(model_class.new)).to include(model_alias)
49
+ end
50
+
51
+ it "returns the model class when queried with #{model_alias.inspect}" do
52
+ expect(resolver.model_for(model_alias)).to eq model_class
53
+ end
54
+ end
55
+ end
56
+
57
+ context 'when using the default instance' do
58
+ let(:resolver) { described_class.instance }
59
+
60
+ context 'when an alias is not specified' do
61
+ quarantine(self) do
62
+ Object.class_eval <<-RUBY, __FILE__, __LINE__ + 1
63
+ module Mongoid; module Specs; module DefaultInstance
64
+ class Vanilla; include Mongoid::Document; end
65
+ end; end; end
66
+ RUBY
67
+ end
68
+
69
+ let(:model_class) { Mongoid::Specs::DefaultInstance::Vanilla }
70
+
71
+ it_behaves_like 'a resolver'
72
+ end
73
+
74
+ context 'when one alias is specified' do
75
+ quarantine(self) do
76
+ Object.class_eval <<-RUBY, __FILE__, __LINE__ + 1
77
+ module Mongoid; module Specs; module DefaultInstance
78
+ class Aliased
79
+ include Mongoid::Document
80
+ identify_as 'aliased'
81
+ end
82
+ end; end; end
83
+ RUBY
84
+ end
85
+
86
+ let(:model_class) { Mongoid::Specs::DefaultInstance::Aliased }
87
+
88
+ it_behaves_like 'a resolver', with_aliases: 'aliased'
89
+ end
90
+
91
+ context 'when multiple aliases are specified' do
92
+ quarantine(self) do
93
+ Object.class_eval <<-RUBY, __FILE__, __LINE__ + 1
94
+ module Mongoid; module Specs; module DefaultInstance
95
+ class AliasedMultiple
96
+ include Mongoid::Document
97
+ identify_as 'aliased', 'alias2', 'alias3'
98
+ end
99
+ end; end; end
100
+ RUBY
101
+ end
102
+
103
+ let(:model_class) { Mongoid::Specs::DefaultInstance::AliasedMultiple }
104
+
105
+ it_behaves_like 'a resolver', with_aliases: %w[ aliased alias2 alias3 ]
106
+ end
107
+ end
108
+
109
+ context 'when using a separate instance' do
110
+ let(:resolver) { described_class.resolver(MONGOID_MODEL_RESOLVER_KEY__) }
111
+
112
+ it 'does not refer to the default instance' do
113
+ expect(resolver).not_to eq described_class.instance
114
+ end
115
+
116
+ context 'when an alias is not specified' do
117
+ quarantine(self) do
118
+ Object.class_eval <<-RUBY, __FILE__, __LINE__ + 1
119
+ module Mongoid; module Specs; module SeparateInstance
120
+ class Vanilla
121
+ include Mongoid::Document
122
+ identify_as resolver: MONGOID_MODEL_RESOLVER_KEY__
123
+ end
124
+ end; end; end
125
+ RUBY
126
+ end
127
+
128
+ let(:model_class) { Mongoid::Specs::SeparateInstance::Vanilla }
129
+
130
+ it_behaves_like 'a resolver'
131
+ end
132
+
133
+ context 'when one alias is specified' do
134
+ quarantine(self) do
135
+ Object.class_eval <<-RUBY, __FILE__, __LINE__ + 1
136
+ module Mongoid; module Specs; module SeparateInstance
137
+ class Aliased
138
+ include Mongoid::Document
139
+ identify_as 'aliased', resolver: MONGOID_MODEL_RESOLVER_KEY__
140
+ end
141
+ end; end; end
142
+ RUBY
143
+ end
144
+
145
+ let(:model_class) { Mongoid::Specs::SeparateInstance::Aliased }
146
+
147
+ it_behaves_like 'a resolver', with_aliases: 'aliased'
148
+ end
149
+
150
+ context 'when multiple aliases are specified' do
151
+ quarantine(self) do
152
+ Object.class_eval <<-RUBY, __FILE__, __LINE__ + 1
153
+ module Mongoid; module Specs; module SeparateInstance
154
+ class AliasedMultiple
155
+ include Mongoid::Document
156
+ identify_as 'aliased', 'alias2', 'alias3', resolver: MONGOID_MODEL_RESOLVER_KEY__
157
+ end
158
+ end; end; end
159
+ RUBY
160
+ end
161
+
162
+ let(:model_class) { Mongoid::Specs::SeparateInstance::AliasedMultiple }
163
+
164
+ it_behaves_like 'a resolver', with_aliases: %w[ aliased alias2 alias3 ]
165
+ end
166
+ end
167
+ end
@@ -5,7 +5,7 @@ require 'spec_helper'
5
5
  # @note This test ensures that we do not inadvertently introduce new monkey patches
6
6
  # to Mongoid. Existing monkey patch methods which are marked with +Mongoid.deprecated+
7
7
  # are excluded from this test.
8
- RSpec.describe('Do not add monkey patches') do # rubocop:disable RSpec/DescribeClass
8
+ RSpec.describe('Do not add monkey patches') do
9
9
  classes = [
10
10
  Object,
11
11
  Array,
@@ -206,12 +206,25 @@ describe Mongoid::PersistenceContext do
206
206
 
207
207
  context 'when the options are valid extra options' do
208
208
 
209
- let(:options) do
210
- { collection: 'other' }
209
+ context 'collection' do
210
+
211
+ let(:options) do
212
+ { collection: 'other' }
213
+ end
214
+
215
+ it 'sets the options on the persistence context object' do
216
+ expect(persistence_context.collection_name).to eq(options[:collection].to_sym)
217
+ end
211
218
  end
212
219
 
213
- it 'sets the options on the persistence context object' do
214
- expect(persistence_context.collection_name).to eq(options[:collection].to_sym)
220
+ context 'collection_options' do
221
+ let(:options) do
222
+ { collection_options: { capped: true } }
223
+ end
224
+
225
+ it 'does not propagate to client options' do
226
+ expect(persistence_context.send(:client_options).key?(:collection_options)).to eq(false)
227
+ end
215
228
  end
216
229
  end
217
230
 
@@ -523,6 +536,20 @@ describe Mongoid::PersistenceContext do
523
536
  end
524
537
  end
525
538
  end
539
+
540
+ context 'when the database is specified as a proc' do
541
+ let(:options) { { database: ->{ 'other' } } }
542
+
543
+ after { persistence_context.client.close }
544
+
545
+ it 'evaluates the proc' do
546
+ expect(persistence_context.database_name).to eq(:other)
547
+ end
548
+
549
+ it 'does not pass the proc to the client' do
550
+ expect(persistence_context.client.database.name).to eq('other')
551
+ end
552
+ end
526
553
  end
527
554
 
528
555
  describe '#client' do
@@ -595,6 +622,23 @@ describe Mongoid::PersistenceContext do
595
622
  end
596
623
  end
597
624
 
625
+ context 'when the client is set as a proc in the storage options' do
626
+ let(:options) { {} }
627
+
628
+ before do
629
+ Band.store_in client: ->{ :alternative }
630
+ end
631
+
632
+ after do
633
+ persistence_context.client.close
634
+ Band.store_in client: nil
635
+ end
636
+
637
+ it 'uses the client option' do
638
+ expect(persistence_context.client).to eq(Mongoid::Clients.with_name(:alternative))
639
+ end
640
+ end
641
+
598
642
  context 'when there is no client option set' do
599
643
 
600
644
  let(:options) do
@@ -2,23 +2,29 @@
2
2
  # rubocop:todo all
3
3
 
4
4
  require 'spec_helper'
5
- require 'active_job'
6
- require 'mongoid/railties/bson_object_id_serializer'
7
5
 
8
- describe 'Mongoid::Railties::ActiveJobSerializers::BsonObjectIdSerializer' do
6
+ begin
7
+ require 'active_job'
8
+ require 'mongoid/railties/bson_object_id_serializer'
9
9
 
10
- let(:serializer) { Mongoid::Railties::ActiveJobSerializers::BsonObjectIdSerializer.instance }
11
- let(:object_id) { BSON::ObjectId.new }
12
10
 
13
- describe '#serialize' do
14
- it 'serializes BSON::ObjectId' do
15
- expect(serializer.serialize(object_id)).to be_a(String)
11
+ describe 'Mongoid::Railties::ActiveJobSerializers::BsonObjectIdSerializer' do
12
+
13
+ let(:serializer) { Mongoid::Railties::ActiveJobSerializers::BsonObjectIdSerializer.instance }
14
+ let(:object_id) { BSON::ObjectId.new }
15
+
16
+ describe '#serialize' do
17
+ it 'serializes BSON::ObjectId' do
18
+ expect(serializer.serialize(object_id)).to be_a(String)
19
+ end
16
20
  end
17
- end
18
21
 
19
- describe '#deserialize' do
20
- it 'deserializes BSON::ObjectId' do
21
- expect(serializer.deserialize(serializer.serialize(object_id))).to eq(object_id)
22
+ describe '#deserialize' do
23
+ it 'deserializes BSON::ObjectId' do
24
+ expect(serializer.deserialize(serializer.serialize(object_id))).to eq(object_id)
25
+ end
22
26
  end
23
27
  end
28
+ rescue LoadError
29
+ RSpec.context.skip 'This test requires active_job'
24
30
  end
@@ -511,13 +511,15 @@ describe Mongoid::Serializable do
511
511
  end
512
512
 
513
513
  it "includes the first relation" do
514
- expect(relation_hash[0]).to include
514
+ expect(relation_hash[0]).to include(
515
515
  { "_id" => "kudamm", "street" => "Kudamm" }
516
+ )
516
517
  end
517
518
 
518
519
  it "includes the second relation" do
519
- expect(relation_hash[1]).to include
520
+ expect(relation_hash[1]).to include(
520
521
  { "_id" => "tauentzienstr", "street" => "Tauentzienstr" }
522
+ )
521
523
  end
522
524
  end
523
525
 
@@ -528,13 +530,15 @@ describe Mongoid::Serializable do
528
530
  end
529
531
 
530
532
  it "includes the first relation" do
531
- expect(relation_hash[0]).to include
533
+ expect(relation_hash[0]).to include(
532
534
  { "_id" => "kudamm", "street" => "Kudamm" }
535
+ )
533
536
  end
534
537
 
535
538
  it "includes the second relation" do
536
- expect(relation_hash[1]).to include
539
+ expect(relation_hash[1]).to include(
537
540
  { "_id" => "tauentzienstr", "street" => "Tauentzienstr" }
541
+ )
538
542
  end
539
543
  end
540
544
 
@@ -653,8 +657,9 @@ describe Mongoid::Serializable do
653
657
  end
654
658
 
655
659
  it "includes the specified relation" do
656
- expect(relation_hash).to include
657
- { "_id" => "leo-marvin", "first_name" => "Leo", "last_name" => "Marvin" }
660
+ expect(relation_hash).to include(
661
+ { "_id" => "Leo-Marvin", "first_name" => "Leo", "last_name" => "Marvin" }
662
+ )
658
663
  end
659
664
  end
660
665
 
@@ -665,8 +670,9 @@ describe Mongoid::Serializable do
665
670
  end
666
671
 
667
672
  it "includes the specified relation" do
668
- expect(relation_hash).to include
669
- { "_id" => "leo-marvin", "first_name" => "Leo", "last_name" => "Marvin" }
673
+ expect(relation_hash).to include(
674
+ { "_id" => "Leo-Marvin", "first_name" => "Leo", "last_name" => "Marvin" }
675
+ )
670
676
  end
671
677
  end
672
678
 
@@ -677,8 +683,9 @@ describe Mongoid::Serializable do
677
683
  end
678
684
 
679
685
  it "includes the specified relation sans exceptions" do
680
- expect(relation_hash).to include
686
+ expect(relation_hash).to include(
681
687
  { "first_name" => "Leo", "last_name" => "Marvin" }
688
+ )
682
689
  end
683
690
  end
684
691
  end
@@ -36,11 +36,11 @@ describe Mongoid::Threaded do
36
36
  context "when the stack has elements" do
37
37
 
38
38
  before do
39
- Thread.current["[mongoid]:load-stack"] = [ true ]
39
+ described_class.stack('load').push(true)
40
40
  end
41
41
 
42
42
  after do
43
- Thread.current["[mongoid]:load-stack"] = []
43
+ described_class.stack('load').clear
44
44
  end
45
45
 
46
46
  it "returns true" do
@@ -51,7 +51,7 @@ describe Mongoid::Threaded do
51
51
  context "when the stack has no elements" do
52
52
 
53
53
  before do
54
- Thread.current["[mongoid]:load-stack"] = []
54
+ described_class.stack('load').clear
55
55
  end
56
56
 
57
57
  it "returns false" do
@@ -76,7 +76,7 @@ describe Mongoid::Threaded do
76
76
  context "when a stack has been initialized" do
77
77
 
78
78
  before do
79
- Thread.current["[mongoid]:load-stack"] = [ true ]
79
+ described_class.stack('load').push(true)
80
80
  end
81
81
 
82
82
  let(:loading) do
@@ -84,7 +84,7 @@ describe Mongoid::Threaded do
84
84
  end
85
85
 
86
86
  after do
87
- Thread.current["[mongoid]:load-stack"] = []
87
+ described_class.stack('load').clear
88
88
  end
89
89
 
90
90
  it "returns the stack" do
@@ -341,4 +341,23 @@ describe Mongoid::Threaded do
341
341
  end
342
342
  end
343
343
  end
344
+
345
+ describe '#clear_modified_documents' do
346
+ let(:session) do
347
+ double(Mongo::Session).tap do |session|
348
+ allow(session).to receive(:in_transaction?).and_return(true)
349
+ end
350
+ end
351
+
352
+ context 'when there are modified documents' do
353
+ before do
354
+ described_class.add_modified_document(session, Minim.new)
355
+ described_class.clear_modified_documents(session)
356
+ end
357
+
358
+ it 'removes the documents and keys' do
359
+ expect(described_class.modified_documents).to be_empty
360
+ end
361
+ end
362
+ end
344
363
  end
@@ -38,12 +38,18 @@ describe Mongoid::Validatable::AssociatedValidator do
38
38
  User.new(name: "test")
39
39
  end
40
40
 
41
- let(:description) do
41
+ let(:description1) do
42
+ Description.new
43
+ end
44
+
45
+ let(:description2) do
42
46
  Description.new
43
47
  end
44
48
 
45
49
  before do
46
- user.descriptions << description
50
+ user.descriptions << description1
51
+ user.descriptions << description2
52
+ user.valid?
47
53
  end
48
54
 
49
55
  it "only validates the parent once" do
@@ -51,12 +57,16 @@ describe Mongoid::Validatable::AssociatedValidator do
51
57
  end
52
58
 
53
59
  it "adds the errors from the relation" do
54
- user.valid?
55
60
  expect(user.errors[:descriptions]).to_not be_nil
56
61
  end
57
62
 
63
+ it 'reports all failed validations' do
64
+ errors = user.descriptions.flat_map { |d| d.errors[:details] }
65
+ expect(errors.length).to be == 2
66
+ end
67
+
58
68
  it "only validates the child once" do
59
- expect(description).to_not be_valid
69
+ expect(description1).to_not be_valid
60
70
  end
61
71
  end
62
72
 
@@ -5,11 +5,11 @@ require "spec_helper"
5
5
  require "mongoid/railties/controller_runtime"
6
6
 
7
7
  describe "Mongoid::Railties::ControllerRuntime" do
8
- controller_runtime = Mongoid::Railties::ControllerRuntime
9
- collector = controller_runtime::Collector
8
+ CONTROLLER_RUNTIME = Mongoid::Railties::ControllerRuntime
9
+ COLLECTOR = CONTROLLER_RUNTIME::Collector
10
10
 
11
- def set_metric value
12
- Thread.current["Mongoid.controller_runtime"] = value
11
+ def set_metric(value)
12
+ Mongoid::Threaded.set(COLLECTOR::VARIABLE_NAME, value)
13
13
  end
14
14
 
15
15
  def clear_metric!
@@ -20,30 +20,30 @@ describe "Mongoid::Railties::ControllerRuntime" do
20
20
 
21
21
  it "stores the metric in thread-safe manner" do
22
22
  clear_metric!
23
- expect(collector.runtime).to eq(0)
23
+ expect(COLLECTOR.runtime).to eq(0)
24
24
  set_metric 42
25
- expect(collector.runtime).to eq(42)
25
+ expect(COLLECTOR.runtime).to eq(42)
26
26
  end
27
27
 
28
28
  it "sets metric on both succeeded and failed" do
29
- instance = collector.new
29
+ instance = COLLECTOR.new
30
30
  event_payload = OpenStruct.new duration: 42
31
31
 
32
32
  clear_metric!
33
33
  instance.succeeded event_payload
34
- expect(collector.runtime).to eq(42000)
34
+ expect(COLLECTOR.runtime).to eq(42000)
35
35
 
36
36
  clear_metric!
37
37
  instance.failed event_payload
38
- expect(collector.runtime).to eq(42000)
38
+ expect(COLLECTOR.runtime).to eq(42000)
39
39
  end
40
40
 
41
41
  it "resets the metric and returns the value" do
42
42
  clear_metric!
43
- expect(collector.reset_runtime).to eq(0)
43
+ expect(COLLECTOR.reset_runtime).to eq(0)
44
44
  set_metric 42
45
- expect(collector.reset_runtime).to eq(42)
46
- expect(collector.runtime).to eq(0)
45
+ expect(COLLECTOR.reset_runtime).to eq(42)
46
+ expect(COLLECTOR.runtime).to eq(0)
47
47
  end
48
48
 
49
49
  end
@@ -67,7 +67,7 @@ describe "Mongoid::Railties::ControllerRuntime" do
67
67
  end
68
68
 
69
69
  controller_class = Class.new reference_controller_class do
70
- include controller_runtime::ControllerExtension
70
+ include CONTROLLER_RUNTIME::ControllerExtension
71
71
  end
72
72
 
73
73
  let(:controller){ controller_class.new }
@@ -75,7 +75,7 @@ describe "Mongoid::Railties::ControllerRuntime" do
75
75
  it "resets the metric before each action" do
76
76
  set_metric 42
77
77
  controller.send(:process_action, 'foo')
78
- expect(collector.runtime).to be(0)
78
+ expect(COLLECTOR.runtime).to be(0)
79
79
  expect(controller.instance_variable_get "@process_action").to be(true)
80
80
  end
81
81
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.0.1
4
+ version: 9.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - The MongoDB Ruby Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-29 00:00:00.000000000 Z
11
+ date: 2024-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.2'
22
+ version: '8.1'
23
23
  - - "!="
24
24
  - !ruby/object:Gem::Version
25
25
  version: 7.0.0
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '5.1'
33
33
  - - "<"
34
34
  - !ruby/object:Gem::Version
35
- version: '7.2'
35
+ version: '8.1'
36
36
  - - "!="
37
37
  - !ruby/object:Gem::Version
38
38
  version: 7.0.0
@@ -168,6 +168,7 @@ files:
168
168
  - lib/mongoid/association/referenced/has_one/eager.rb
169
169
  - lib/mongoid/association/referenced/has_one/proxy.rb
170
170
  - lib/mongoid/association/referenced/syncable.rb
171
+ - lib/mongoid/association/referenced/with_polymorphic_criteria.rb
171
172
  - lib/mongoid/association/reflections.rb
172
173
  - lib/mongoid/association/relatable.rb
173
174
  - lib/mongoid/atomic.rb
@@ -335,6 +336,9 @@ files:
335
336
  - lib/mongoid/errors/transactions_not_supported.rb
336
337
  - lib/mongoid/errors/unknown_attribute.rb
337
338
  - lib/mongoid/errors/unknown_model.rb
339
+ - lib/mongoid/errors/unrecognized_model_alias.rb
340
+ - lib/mongoid/errors/unrecognized_resolver.rb
341
+ - lib/mongoid/errors/unregistered_class.rb
338
342
  - lib/mongoid/errors/unsaved_document.rb
339
343
  - lib/mongoid/errors/unsupported_javascript.rb
340
344
  - lib/mongoid/errors/validations.rb
@@ -373,6 +377,7 @@ files:
373
377
  - lib/mongoid/fields/validators.rb
374
378
  - lib/mongoid/fields/validators/macro.rb
375
379
  - lib/mongoid/findable.rb
380
+ - lib/mongoid/identifiable.rb
376
381
  - lib/mongoid/indexable.rb
377
382
  - lib/mongoid/indexable/specification.rb
378
383
  - lib/mongoid/indexable/validators/options.rb
@@ -413,6 +418,7 @@ files:
413
418
  - lib/mongoid/matcher/regex.rb
414
419
  - lib/mongoid/matcher/size.rb
415
420
  - lib/mongoid/matcher/type.rb
421
+ - lib/mongoid/model_resolver.rb
416
422
  - lib/mongoid/persistable.rb
417
423
  - lib/mongoid/persistable/creatable.rb
418
424
  - lib/mongoid/persistable/deletable.rb
@@ -578,6 +584,7 @@ files:
578
584
  - spec/integration/matcher_operator_data/type_undefined.yml
579
585
  - spec/integration/matcher_operator_spec.rb
580
586
  - spec/integration/matcher_spec.rb
587
+ - spec/integration/persistence/collection_options_spec.rb
581
588
  - spec/integration/persistence/range_field_spec.rb
582
589
  - spec/integration/server_query_spec.rb
583
590
  - spec/integration/shardable_spec.rb
@@ -828,6 +835,7 @@ files:
828
835
  - spec/mongoid/matcher/extract_attribute_data/numeric_keys.yml
829
836
  - spec/mongoid/matcher/extract_attribute_data/traversal.yml
830
837
  - spec/mongoid/matcher/extract_attribute_spec.rb
838
+ - spec/mongoid/model_resolver_spec.rb
831
839
  - spec/mongoid/mongoizable_spec.rb
832
840
  - spec/mongoid/monkey_patches_spec.rb
833
841
  - spec/mongoid/persistable/creatable_spec.rb
@@ -1298,6 +1306,7 @@ test_files:
1298
1306
  - spec/integration/matcher_operator_data/type_undefined.yml
1299
1307
  - spec/integration/matcher_operator_spec.rb
1300
1308
  - spec/integration/matcher_spec.rb
1309
+ - spec/integration/persistence/collection_options_spec.rb
1301
1310
  - spec/integration/persistence/range_field_spec.rb
1302
1311
  - spec/integration/server_query_spec.rb
1303
1312
  - spec/integration/shardable_spec.rb
@@ -1548,6 +1557,7 @@ test_files:
1548
1557
  - spec/mongoid/matcher/extract_attribute_data/numeric_keys.yml
1549
1558
  - spec/mongoid/matcher/extract_attribute_data/traversal.yml
1550
1559
  - spec/mongoid/matcher/extract_attribute_spec.rb
1560
+ - spec/mongoid/model_resolver_spec.rb
1551
1561
  - spec/mongoid/mongoizable_spec.rb
1552
1562
  - spec/mongoid/monkey_patches_spec.rb
1553
1563
  - spec/mongoid/persistable/creatable_spec.rb