mongoid 6.2.0 → 6.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -2
- data.tar.gz.sig +0 -0
- data/lib/mongoid/composable.rb +2 -2
- data/lib/mongoid/contextual/map_reduce.rb +4 -0
- data/lib/mongoid/railtie.rb +0 -1
- data/lib/mongoid/relations/referenced/many.rb +6 -8
- data/lib/mongoid/stateful.rb +1 -0
- data/lib/mongoid/version.rb +1 -1
- data/spec/app/models/agent.rb +2 -0
- data/spec/app/models/band.rb +2 -0
- data/spec/mongoid/document_spec.rb +9 -2
- data/spec/mongoid/relations/referenced/many_spec.rb +22 -0
- metadata +2 -5
- metadata.gz.sig +0 -0
- data/lib/mongoid/railties/document.rb +0 -12
- data/spec/mongoid/railties/document_spec.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3c168797ecc312fa19fb9e5e411faac9d8d0386
|
4
|
+
data.tar.gz: d8221f9f5edf4199630a5951169150ed864830af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f7acb7b8783289ff4a2986353e4eeb0443643d4b957ed15752a37045a7e906bda3cb5cc5ebf3d75c222ce8926aee29176b38cab2baad80e663fc83eb0bb1b02
|
7
|
+
data.tar.gz: 45304b581fdcca4076ce109db08926de9e30917f9ac439f94b2bd51fbfe3939d32dce787f48236738cd015c0c0b2e90c7d68905dd5744b08ec33adb3a8ccaae2
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
�
|
2
|
-
|
1
|
+
y~z�L�|t�T��נq'��`�B~gg�%�U�&?U�Ů�;����@n�Wɞ����H����ۄ�\{6�!$u�42{�8�GC���W�Q8����9�]�c~+,*�V{{��@=*ȴ��7�$_b���2�`���dQ7���#-g�**w�v����7���~��Q�?�A���;^IԪFN�ARm?��)7�����1��Y�
|
2
|
+
�Ċ�;]����%D������y:<H����/�PT�u�,O%�s��1��Dۯ
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/mongoid/composable.rb
CHANGED
@@ -75,6 +75,7 @@ module Mongoid
|
|
75
75
|
Scopable,
|
76
76
|
Serializable,
|
77
77
|
Clients,
|
78
|
+
Clients::Options,
|
78
79
|
Shardable,
|
79
80
|
Stateful,
|
80
81
|
Cacheable,
|
@@ -84,8 +85,7 @@ module Mongoid
|
|
84
85
|
Equality,
|
85
86
|
Relations::Synchronization,
|
86
87
|
ActiveModel::Model,
|
87
|
-
ActiveModel::Validations
|
88
|
-
PersistenceContext
|
88
|
+
ActiveModel::Validations
|
89
89
|
]
|
90
90
|
|
91
91
|
# These are methods names defined in included blocks that may conflict
|
@@ -111,6 +111,7 @@ module Mongoid
|
|
111
111
|
end
|
112
112
|
|
113
113
|
# Specifies where the map/reduce output is to be stored.
|
114
|
+
# Please see MongoDB documentation for supported map reduce options.
|
114
115
|
#
|
115
116
|
# @example Store output in memory.
|
116
117
|
# map_reduce.out(inline: 1)
|
@@ -124,6 +125,9 @@ module Mongoid
|
|
124
125
|
# @example Store output in a collection, reducing existing documents.
|
125
126
|
# map_reduce.out(reduce: "collection_name")
|
126
127
|
#
|
128
|
+
# @example Return results from map reduce.
|
129
|
+
# map_reduce.out(inline: 1)
|
130
|
+
#
|
127
131
|
# @param [ Hash ] location The place to store the results.
|
128
132
|
#
|
129
133
|
# @return [ MapReduce ] The map/reduce object.
|
data/lib/mongoid/railtie.rb
CHANGED
@@ -607,14 +607,12 @@ module Mongoid
|
|
607
607
|
# @since 2.1.0
|
608
608
|
def criteria(metadata, object, type = nil)
|
609
609
|
apply_ordering(
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
metadata
|
617
|
-
), metadata
|
610
|
+
with_polymorphic_criterion(
|
611
|
+
metadata.klass.where(metadata.foreign_key => object),
|
612
|
+
metadata,
|
613
|
+
type
|
614
|
+
),
|
615
|
+
metadata
|
618
616
|
)
|
619
617
|
end
|
620
618
|
|
data/lib/mongoid/stateful.rb
CHANGED
@@ -43,6 +43,7 @@ module Mongoid
|
|
43
43
|
@flagged_for_destroy ||= false
|
44
44
|
end
|
45
45
|
alias :marked_for_destruction? :flagged_for_destroy?
|
46
|
+
alias :_destroy :flagged_for_destroy?
|
46
47
|
|
47
48
|
# Returns true if the +Document+ has been succesfully destroyed, and false
|
48
49
|
# if it hasn't. This is determined by the variable @destroyed and NOT
|
data/lib/mongoid/version.rb
CHANGED
data/spec/app/models/agent.rb
CHANGED
data/spec/app/models/band.rb
CHANGED
@@ -22,6 +22,8 @@ class Band
|
|
22
22
|
embeds_many :notes, as: :noteable, cascade_callbacks: true, validate: false
|
23
23
|
embeds_one :label, cascade_callbacks: true
|
24
24
|
|
25
|
+
has_many :same_name, class_name: 'Agent', inverse_of: :same_name
|
26
|
+
|
25
27
|
after_upsert do |doc|
|
26
28
|
doc.upserted = true
|
27
29
|
end
|
@@ -10,10 +10,17 @@ describe Mongoid::Document do
|
|
10
10
|
Person.new
|
11
11
|
end
|
12
12
|
|
13
|
-
it "
|
14
|
-
expect(
|
13
|
+
it "defines a _destroy method" do
|
14
|
+
expect(Person.new).to respond_to(:_destroy)
|
15
15
|
end
|
16
16
|
|
17
|
+
describe "#_destroy" do
|
18
|
+
|
19
|
+
it "default to false" do
|
20
|
+
expect(Person.new._destroy).to be false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
17
24
|
describe ".included" do
|
18
25
|
|
19
26
|
let(:models) do
|
@@ -3791,4 +3791,26 @@ describe Mongoid::Relations::Referenced::Many do
|
|
3791
3791
|
expect(agent.save).to be(true)
|
3792
3792
|
end
|
3793
3793
|
end
|
3794
|
+
|
3795
|
+
context 'when the two models use the same name to refer to the relation' do
|
3796
|
+
|
3797
|
+
let(:agent) do
|
3798
|
+
Agent.new
|
3799
|
+
end
|
3800
|
+
|
3801
|
+
let(:band) do
|
3802
|
+
Band.new
|
3803
|
+
end
|
3804
|
+
|
3805
|
+
before do
|
3806
|
+
agent.same_name = band
|
3807
|
+
agent.save
|
3808
|
+
band.save
|
3809
|
+
band.reload
|
3810
|
+
end
|
3811
|
+
|
3812
|
+
it 'constructs the correct criteria' do
|
3813
|
+
expect(band.same_name).to eq([agent])
|
3814
|
+
end
|
3815
|
+
end
|
3794
3816
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.2.
|
4
|
+
version: 6.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Durran Jordan
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
cGiNQIiHBj/9/xHfOyOthBPUevTiVnuffarDr434z/LGLwYzgaG5EcJFvZqpvUpP
|
31
31
|
fGcAPtAZUMGLXwcOB1BJEFkDxUQIJiEpSmf4YzzZhEM=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2017-
|
33
|
+
date: 2017-08-15 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: activemodel
|
@@ -280,7 +280,6 @@ files:
|
|
280
280
|
- lib/mongoid/query_cache.rb
|
281
281
|
- lib/mongoid/railtie.rb
|
282
282
|
- lib/mongoid/railties/database.rake
|
283
|
-
- lib/mongoid/railties/document.rb
|
284
283
|
- lib/mongoid/relations.rb
|
285
284
|
- lib/mongoid/relations/accessors.rb
|
286
285
|
- lib/mongoid/relations/auto_save.rb
|
@@ -765,7 +764,6 @@ files:
|
|
765
764
|
- spec/mongoid/persistence_context_spec.rb
|
766
765
|
- spec/mongoid/positional_spec.rb
|
767
766
|
- spec/mongoid/query_cache_spec.rb
|
768
|
-
- spec/mongoid/railties/document_spec.rb
|
769
767
|
- spec/mongoid/relations/accessors_spec.rb
|
770
768
|
- spec/mongoid/relations/auto_save_spec.rb
|
771
769
|
- spec/mongoid/relations/bindings/embedded/in_spec.rb
|
@@ -1259,7 +1257,6 @@ test_files:
|
|
1259
1257
|
- spec/mongoid/persistence_context_spec.rb
|
1260
1258
|
- spec/mongoid/positional_spec.rb
|
1261
1259
|
- spec/mongoid/query_cache_spec.rb
|
1262
|
-
- spec/mongoid/railties/document_spec.rb
|
1263
1260
|
- spec/mongoid/relations/accessors_spec.rb
|
1264
1261
|
- spec/mongoid/relations/auto_save_spec.rb
|
1265
1262
|
- spec/mongoid/relations/bindings/embedded/in_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module Mongoid
|
2
|
-
module Document
|
3
|
-
# Used in conjunction with fields_for to build a form element for the
|
4
|
-
# destruction of this association. Always returns false because Mongoid
|
5
|
-
# only supports immediate deletion of associations.
|
6
|
-
#
|
7
|
-
# See ActionView::Helpers::FormHelper::fields_for for more info.
|
8
|
-
def _destroy
|
9
|
-
false
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "A document loaded from rails" do
|
4
|
-
before(:all) do
|
5
|
-
require 'mongoid/railties/document'
|
6
|
-
end
|
7
|
-
|
8
|
-
after(:all) do
|
9
|
-
Mongoid::Document.class_eval do
|
10
|
-
undef _destroy
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
it "defines a _destroy method" do
|
15
|
-
expect(Person.new).to respond_to(:_destroy)
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "#_destroy" do
|
19
|
-
|
20
|
-
it "always returns false" do
|
21
|
-
expect(Person.new._destroy).to be false
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|