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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ad94ff3f533cda7ba799fbe4ea06a5a3fde553e
4
- data.tar.gz: 3a20eae84bfb9f4639b3b1efa76dfacc6dbcd46e
3
+ metadata.gz: e3c168797ecc312fa19fb9e5e411faac9d8d0386
4
+ data.tar.gz: d8221f9f5edf4199630a5951169150ed864830af
5
5
  SHA512:
6
- metadata.gz: 1b5d2570c1dedf556f81e40bd2e1ef38157c39757decab9d12a111c239c3ad823c0da7a4804c4e558c9b612388f560e8c5b6007daac1e2a23a3505fb52c03db3
7
- data.tar.gz: 3d966d851b62722926e7dc78ff18badd848722f5a6ebcc0f9da6e7820974a5c521b37d00ccd0029756c7eb28c36b2e9a0bcdbf8150277a2f4fe2e6ee583a90cc
6
+ metadata.gz: 8f7acb7b8783289ff4a2986353e4eeb0443643d4b957ed15752a37045a7e906bda3cb5cc5ebf3d75c222ce8926aee29176b38cab2baad80e663fc83eb0bb1b02
7
+ data.tar.gz: 45304b581fdcca4076ce109db08926de9e30917f9ac439f94b2bd51fbfe3939d32dce787f48236738cd015c0c0b2e90c7d68905dd5744b08ec33adb3a8ccaae2
@@ -1,2 +1,2 @@
1
- os5P��s���F�:9@
2
- Jϕ����$�9�!yULU��B�˒2V�]���,Efy��Y�-�w�� �\(bb�Q�h��"�#���Mؗ�=Q�4�-�[;9�,����p���0�J[tHQB�I���8���C�x�!��H��߂���Wawd&]w|��P����W#,�Q1斸��s�o�,�r.z�4��Ů��ZH)�NVK�>�=*�L�v�w�B��,�=��J�5ٛd�c�=}Y.�H�x���%
1
+ y~zL�|tT��נq'��`�B~gg�%�U�&?U�Ů�;����@nWɞ����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����/�PTu�,O%�s��1��Dۯ
data.tar.gz.sig CHANGED
Binary file
@@ -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.
@@ -1,5 +1,4 @@
1
1
  # encoding: utf-8
2
- require "mongoid/railties/document"
3
2
  require "rails"
4
3
  require "rails/mongoid"
5
4
 
@@ -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
- with_inverse_field_criterion(
611
- with_polymorphic_criterion(
612
- metadata.klass.where(metadata.foreign_key => object),
613
- metadata,
614
- type
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
 
@@ -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
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Mongoid
3
- VERSION = "6.2.0"
3
+ VERSION = "6.2.1"
4
4
  end
@@ -9,6 +9,8 @@ class Agent
9
9
  belongs_to :game
10
10
  belongs_to :agency, touch: true, autobuild: true
11
11
 
12
+ belongs_to :same_name, class_name: 'Band', inverse_of: :same_name
13
+
12
14
  has_and_belongs_to_many :accounts
13
15
  has_and_belongs_to_many :basics
14
16
  end
@@ -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 "does not respond to _destroy" do
14
- expect(person).to_not respond_to(:_destroy)
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.0
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-06-07 00:00:00.000000000 Z
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