mongoid 2.3.5 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. data/CHANGELOG.md +34 -176
  2. data/LICENSE +1 -1
  3. data/lib/config/locales/bg.yml +6 -0
  4. data/lib/config/locales/de.yml +6 -0
  5. data/lib/config/locales/en-GB.yml +8 -0
  6. data/lib/config/locales/en.yml +8 -0
  7. data/lib/config/locales/es.yml +9 -3
  8. data/lib/config/locales/fr.yml +6 -0
  9. data/lib/config/locales/hi.yml +6 -0
  10. data/lib/config/locales/hu.yml +6 -0
  11. data/lib/config/locales/id.yml +6 -0
  12. data/lib/config/locales/it.yml +6 -0
  13. data/lib/config/locales/ja.yml +6 -0
  14. data/lib/config/locales/kr.yml +6 -0
  15. data/lib/config/locales/nl.yml +8 -0
  16. data/lib/config/locales/pl.yml +6 -0
  17. data/lib/config/locales/pt-BR.yml +6 -0
  18. data/lib/config/locales/pt.yml +8 -2
  19. data/lib/config/locales/ro.yml +6 -0
  20. data/lib/config/locales/ru.yml +6 -0
  21. data/lib/config/locales/sv.yml +6 -0
  22. data/lib/config/locales/vi.yml +14 -8
  23. data/lib/config/locales/zh-CN.yml +6 -0
  24. data/lib/mongoid/atomic.rb +62 -13
  25. data/lib/mongoid/atomic/modifiers.rb +33 -1
  26. data/lib/mongoid/attributes.rb +5 -19
  27. data/lib/mongoid/callbacks.rb +2 -1
  28. data/lib/mongoid/collection.rb +2 -2
  29. data/lib/mongoid/collections/retry.rb +18 -6
  30. data/lib/mongoid/components.rb +2 -0
  31. data/lib/mongoid/config.rb +8 -63
  32. data/lib/mongoid/config/environment.rb +41 -0
  33. data/lib/mongoid/config/options.rb +74 -0
  34. data/lib/mongoid/contexts/enumerable.rb +0 -24
  35. data/lib/mongoid/contexts/mongo.rb +33 -3
  36. data/lib/mongoid/copyable.rb +1 -1
  37. data/lib/mongoid/criteria.rb +4 -2
  38. data/lib/mongoid/criterion/inclusion.rb +1 -16
  39. data/lib/mongoid/criterion/optional.rb +37 -10
  40. data/lib/mongoid/criterion/scoping.rb +83 -0
  41. data/lib/mongoid/criterion/selector.rb +9 -6
  42. data/lib/mongoid/default_scope.rb +1 -1
  43. data/lib/mongoid/dirty.rb +163 -29
  44. data/lib/mongoid/document.rb +58 -7
  45. data/lib/mongoid/errors.rb +2 -0
  46. data/lib/mongoid/errors/no_environment.rb +19 -0
  47. data/lib/mongoid/errors/scope_overwrite.rb +21 -0
  48. data/lib/mongoid/extensions.rb +6 -0
  49. data/lib/mongoid/extensions/array/deep_copy.rb +25 -0
  50. data/lib/mongoid/extensions/hash/deep_copy.rb +25 -0
  51. data/lib/mongoid/extensions/hash/scoping.rb +1 -1
  52. data/lib/mongoid/extensions/object/deep_copy.rb +21 -0
  53. data/lib/mongoid/extensions/proc/scoping.rb +2 -2
  54. data/lib/mongoid/extensions/symbol/inflections.rb +1 -0
  55. data/lib/mongoid/fields.rb +171 -104
  56. data/lib/mongoid/fields/{serializable → internal}/array.rb +33 -1
  57. data/lib/mongoid/fields/{serializable → internal}/big_decimal.rb +16 -1
  58. data/lib/mongoid/fields/{serializable → internal}/bignum.rb +1 -1
  59. data/lib/mongoid/fields/{serializable → internal}/binary.rb +1 -1
  60. data/lib/mongoid/fields/{serializable → internal}/boolean.rb +16 -1
  61. data/lib/mongoid/fields/{serializable → internal}/date.rb +1 -1
  62. data/lib/mongoid/fields/{serializable → internal}/date_time.rb +1 -1
  63. data/lib/mongoid/fields/{serializable → internal}/fixnum.rb +1 -1
  64. data/lib/mongoid/fields/{serializable → internal}/float.rb +16 -1
  65. data/lib/mongoid/fields/internal/foreign_keys/array.rb +74 -0
  66. data/lib/mongoid/fields/{serializable → internal}/foreign_keys/object.rb +11 -2
  67. data/lib/mongoid/fields/{serializable → internal}/hash.rb +1 -1
  68. data/lib/mongoid/fields/{serializable → internal}/integer.rb +16 -1
  69. data/lib/mongoid/fields/{serializable → internal}/localized.rb +23 -2
  70. data/lib/mongoid/fields/{serializable → internal}/nil_class.rb +16 -1
  71. data/lib/mongoid/fields/{serializable → internal}/object.rb +1 -1
  72. data/lib/mongoid/fields/{serializable → internal}/object_id.rb +16 -1
  73. data/lib/mongoid/fields/{serializable → internal}/range.rb +21 -2
  74. data/lib/mongoid/fields/{serializable → internal}/set.rb +16 -1
  75. data/lib/mongoid/fields/{serializable → internal}/string.rb +16 -1
  76. data/lib/mongoid/fields/{serializable → internal}/symbol.rb +17 -1
  77. data/lib/mongoid/fields/{serializable → internal}/time.rb +1 -1
  78. data/lib/mongoid/fields/{serializable → internal}/time_with_zone.rb +1 -1
  79. data/lib/mongoid/fields/{serializable → internal}/timekeeping.rb +16 -1
  80. data/lib/mongoid/fields/mappings.rb +8 -3
  81. data/lib/mongoid/fields/serializable.rb +34 -3
  82. data/lib/mongoid/hierarchy.rb +14 -14
  83. data/lib/mongoid/identity_map.rb +3 -2
  84. data/lib/mongoid/logger.rb +1 -7
  85. data/lib/mongoid/named_scope.rb +16 -12
  86. data/lib/mongoid/observer.rb +5 -1
  87. data/lib/mongoid/paranoia.rb +1 -0
  88. data/lib/mongoid/persistence.rb +11 -4
  89. data/lib/mongoid/persistence/atomic.rb +4 -1
  90. data/lib/mongoid/persistence/atomic/add_to_set.rb +17 -1
  91. data/lib/mongoid/persistence/atomic/sets.rb +1 -1
  92. data/lib/mongoid/railties/database.rake +1 -1
  93. data/lib/mongoid/relations.rb +1 -3
  94. data/lib/mongoid/relations/auto_save.rb +1 -1
  95. data/lib/mongoid/relations/builders.rb +1 -1
  96. data/lib/mongoid/relations/builders/embedded/many.rb +2 -6
  97. data/lib/mongoid/relations/builders/nested_attributes/many.rb +1 -1
  98. data/lib/mongoid/relations/builders/nested_attributes/one.rb +1 -1
  99. data/lib/mongoid/relations/builders/referenced/many_to_many.rb +1 -1
  100. data/lib/mongoid/relations/cascading/delete.rb +1 -1
  101. data/lib/mongoid/relations/cyclic.rb +10 -6
  102. data/lib/mongoid/relations/embedded/atomic.rb +3 -3
  103. data/lib/mongoid/relations/embedded/many.rb +98 -20
  104. data/lib/mongoid/relations/macros.rb +2 -0
  105. data/lib/mongoid/relations/many.rb +13 -0
  106. data/lib/mongoid/relations/metadata.rb +3 -3
  107. data/lib/mongoid/relations/nested_builder.rb +4 -3
  108. data/lib/mongoid/relations/proxy.rb +0 -1
  109. data/lib/mongoid/relations/referenced/batch.rb +3 -2
  110. data/lib/mongoid/relations/referenced/in.rb +3 -3
  111. data/lib/mongoid/relations/referenced/many.rb +89 -10
  112. data/lib/mongoid/relations/referenced/many_to_many.rb +34 -43
  113. data/lib/mongoid/relations/referenced/one.rb +8 -4
  114. data/lib/mongoid/relations/synchronization.rb +22 -5
  115. data/lib/mongoid/threaded.rb +38 -276
  116. data/lib/mongoid/threaded/lifecycle.rb +18 -18
  117. data/lib/mongoid/timestamps/updated.rb +13 -3
  118. data/lib/mongoid/validations.rb +22 -1
  119. data/lib/mongoid/validations/presence.rb +40 -0
  120. data/lib/mongoid/validations/uniqueness.rb +14 -3
  121. data/lib/mongoid/version.rb +1 -1
  122. data/lib/mongoid/versioning.rb +6 -2
  123. data/lib/rails/mongoid.rb +7 -1
  124. metadata +64 -45
  125. data/lib/mongoid/fields/serializable/foreign_keys/array.rb +0 -42
  126. data/lib/mongoid/relations/embedded/sort.rb +0 -31
@@ -22,10 +22,10 @@ module Mongoid #:nodoc:
22
22
  #
23
23
  # @since 2.2.0
24
24
  def _assigning
25
- Threaded.begin_assign
25
+ Threaded.begin(:assign)
26
26
  yield
27
27
  ensure
28
- Threaded.exit_assign
28
+ Threaded.exit(:assign)
29
29
  end
30
30
 
31
31
  # Is the current thread in assigning mode?
@@ -37,7 +37,7 @@ module Mongoid #:nodoc:
37
37
  #
38
38
  # @since 2.1.0
39
39
  def _assigning?
40
- Threaded.assigning?
40
+ Threaded.executing?(:assign)
41
41
  end
42
42
 
43
43
  # Execute a block in binding mode.
@@ -51,10 +51,10 @@ module Mongoid #:nodoc:
51
51
  #
52
52
  # @since 2.1.0
53
53
  def _binding
54
- Threaded.begin_bind
54
+ Threaded.begin(:bind)
55
55
  yield
56
56
  ensure
57
- Threaded.exit_bind
57
+ Threaded.exit(:bind)
58
58
  end
59
59
 
60
60
  # Is the current thread in binding mode?
@@ -66,7 +66,7 @@ module Mongoid #:nodoc:
66
66
  #
67
67
  # @since 2.1.0
68
68
  def _binding?
69
- Threaded.binding?
69
+ Threaded.executing?(:bind)
70
70
  end
71
71
 
72
72
  # Execute a block in building mode.
@@ -80,10 +80,10 @@ module Mongoid #:nodoc:
80
80
  #
81
81
  # @since 2.1.0
82
82
  def _building
83
- Threaded.begin_build
83
+ Threaded.begin(:build)
84
84
  yield
85
85
  ensure
86
- Threaded.exit_build
86
+ Threaded.exit(:build)
87
87
  end
88
88
 
89
89
  # Is the current thread in building mode?
@@ -95,7 +95,7 @@ module Mongoid #:nodoc:
95
95
  #
96
96
  # @since 2.1.0
97
97
  def _building?
98
- Threaded.building?
98
+ Threaded.executing?(:build)
99
99
  end
100
100
 
101
101
  # Is the current thread in creating mode?
@@ -107,7 +107,7 @@ module Mongoid #:nodoc:
107
107
  #
108
108
  # @since 2.1.0
109
109
  def _creating?
110
- Threaded.creating?
110
+ Threaded.executing?(:create)
111
111
  end
112
112
 
113
113
  # Execute a block in loading mode.
@@ -121,10 +121,10 @@ module Mongoid #:nodoc:
121
121
  #
122
122
  # @since 2.3.2
123
123
  def _loading
124
- Threaded.begin_load
124
+ Threaded.begin(:load)
125
125
  yield
126
126
  ensure
127
- Threaded.exit_load
127
+ Threaded.exit(:load)
128
128
  end
129
129
 
130
130
  # Is the current thread in loading mode?
@@ -136,7 +136,7 @@ module Mongoid #:nodoc:
136
136
  #
137
137
  # @since 2.3.2
138
138
  def _loading?
139
- Threaded.loading?
139
+ Threaded.executing?(:load)
140
140
  end
141
141
 
142
142
  # Execute a block in loading revision mode.
@@ -150,10 +150,10 @@ module Mongoid #:nodoc:
150
150
  #
151
151
  # @since 2.3.4
152
152
  def _loading_revision
153
- Threaded.begin_load_revision
153
+ Threaded.begin(:load_revision)
154
154
  yield
155
155
  ensure
156
- Threaded.exit_load_revision
156
+ Threaded.exit(:load_revision)
157
157
  end
158
158
 
159
159
  module ClassMethods #:nodoc:
@@ -169,10 +169,10 @@ module Mongoid #:nodoc:
169
169
  #
170
170
  # @since 2.1.0
171
171
  def _creating
172
- Threaded.begin_create
172
+ Threaded.begin(:create)
173
173
  yield
174
174
  ensure
175
- Threaded.exit_create
175
+ Threaded.exit(:create)
176
176
  end
177
177
 
178
178
  # Is the current thread in loading revision mode?
@@ -184,7 +184,7 @@ module Mongoid #:nodoc:
184
184
  #
185
185
  # @since 2.3.4
186
186
  def _loading_revision?
187
- Threaded.loading_revision?
187
+ Threaded.executing?(:load_revision)
188
188
  end
189
189
  end
190
190
  end
@@ -8,9 +8,7 @@ module Mongoid #:nodoc:
8
8
 
9
9
  included do
10
10
  field :updated_at, :type => Time, :versioned => false
11
- set_callback :save, :before, :set_updated_at, :if => Proc.new { |doc|
12
- doc.timestamping? && (doc.new_record? || doc.changed?)
13
- }
11
+ set_callback :save, :before, :set_updated_at, :if => :able_to_set_updated_at?
14
12
  end
15
13
 
16
14
  # Update the updated_at field on the Document to the current time.
@@ -21,6 +19,18 @@ module Mongoid #:nodoc:
21
19
  def set_updated_at
22
20
  self.updated_at = Time.now.utc unless updated_at_changed?
23
21
  end
22
+
23
+ # Is the updated timestamp able to be set?
24
+ #
25
+ # @example Can the timestamp be set?
26
+ # document.able_to_set_updated_at?
27
+ #
28
+ # @return [ true, false ] If the timestamp can be set.
29
+ #
30
+ # @since 2.4.0
31
+ def able_to_set_updated_at?
32
+ !frozen? && timestamping? && (new_record? || changed?)
33
+ end
24
34
  end
25
35
  end
26
36
  end
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require "mongoid/validations/associated"
3
3
  require "mongoid/validations/uniqueness"
4
+ require "mongoid/validations/presence"
4
5
 
5
6
  module Mongoid #:nodoc:
6
7
 
@@ -43,11 +44,14 @@ module Mongoid #:nodoc:
43
44
  #
44
45
  # @since 2.0.0.rc.1
45
46
  def read_attribute_for_validation(attr)
46
- if relations[attr.to_s]
47
+ attribute = attr.to_s
48
+ if relations[attribute]
47
49
  begin_validate
48
50
  relation = send(attr)
49
51
  exit_validate
50
52
  relation.do_or_do_not(:in_memory) || relation
53
+ elsif fields[attribute] && fields[attribute].localized?
54
+ attributes[attribute]
51
55
  else
52
56
  send(attr)
53
57
  end
@@ -119,6 +123,23 @@ module Mongoid #:nodoc:
119
123
  validates_with(UniquenessValidator, _merge_attributes(args))
120
124
  end
121
125
 
126
+ # Validates whether or not a field is present - meaning nil or empty.
127
+ #
128
+ # @example
129
+ # class Person
130
+ # include Mongoid::Document
131
+ # field :title
132
+ #
133
+ # validates_presence_of :title
134
+ # end
135
+ #
136
+ # @param [ Array ] args The names of the fields to validate.
137
+ #
138
+ # @since 2.4.0
139
+ def validates_presence_of(*args)
140
+ validates_with(PresenceValidator, _merge_attributes(args))
141
+ end
142
+
122
143
  protected
123
144
 
124
145
  # Adds an associated validator for the relation if the validate option
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+ module Mongoid #:nodoc:
3
+ module Validations #:nodoc:
4
+
5
+ # Validates that the specified attributes are not blank (as defined by
6
+ # Object#blank?).
7
+ #
8
+ # @example Define the presence validator.
9
+ #
10
+ # class Person
11
+ # include Mongoid::Document
12
+ # field :title
13
+ #
14
+ # validates_presence_of :title
15
+ # end
16
+ class PresenceValidator < ActiveModel::EachValidator
17
+
18
+ # Validate the document for the attribute and value.
19
+ #
20
+ # @example Validate the document.
21
+ # validator.validate_each(doc, :title, "")
22
+ #
23
+ # @param [ Document ] document The document to validate.
24
+ # @param [ Symbol ] attribute The attribute name.
25
+ # @param [ Object ] value The current value of the field.
26
+ #
27
+ # @since 2.4.0
28
+ def validate_each(document, attribute, value)
29
+ field = document.fields[attribute.to_s]
30
+ if field && field.localized? && !value.blank?
31
+ value.each_pair do |locale, value|
32
+ document.errors.add(attribute, :blank, options) if value.blank?
33
+ end
34
+ else
35
+ document.errors.add(attribute, :blank, options) if value.blank?
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -47,14 +47,25 @@ module Mongoid #:nodoc:
47
47
  criteria = relation.where(criterion(document, attribute, value))
48
48
  criteria = scope(criteria, document, attribute)
49
49
  if document.primary_key == Array.wrap(attribute)
50
- document.errors.add(attribute, :taken) if criteria.count > 1
50
+ if criteria.count > 1
51
+ document.errors.add(
52
+ attribute,
53
+ :taken, options.except(:case_sensitive, :scope).merge(:value => value)
54
+ )
55
+ end
51
56
  else
52
- document.errors.add(attribute, :taken) if criteria.exists?
57
+ if criteria.exists?
58
+ document.errors.add(
59
+ attribute,
60
+ :taken,
61
+ options.except(:case_sensitive, :scope).merge(:value => value)
62
+ )
63
+ end
53
64
  end
54
65
  else
55
66
  criteria = klass.where(criterion(document, attribute, value))
56
67
  criteria = scope(criteria, document, attribute)
57
- document.errors.add(attribute, :taken) if criteria.exists?
68
+ document.errors.add(attribute, :taken, options.except(:case_sensitive, :scope).merge(:value => value)) if criteria.exists?
58
69
  end
59
70
  end
60
71
 
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Mongoid #:nodoc
3
- VERSION = "2.3.5"
3
+ VERSION = "2.4.0"
4
4
  end
@@ -36,7 +36,9 @@ module Mongoid #:nodoc:
36
36
  def revise
37
37
  previous = previous_revision
38
38
  if previous && versioned_attributes_changed?
39
- versions.build(previous.versioned_attributes).attributes.delete("_id")
39
+ versions.build(
40
+ previous.versioned_attributes, :without_protection => true
41
+ ).attributes.delete("_id")
40
42
  if version_max.present? && versions.length > version_max
41
43
  versions.delete(versions.first)
42
44
  end
@@ -52,7 +54,9 @@ module Mongoid #:nodoc:
52
54
  #
53
55
  # @since 2.2.1
54
56
  def revise!
55
- new_version = versions.build((previous_revision || self).versioned_attributes)
57
+ new_version = versions.build(
58
+ (previous_revision || self).versioned_attributes, :without_protection => true
59
+ )
56
60
  versions.shift if version_max.present? && versions.length > version_max
57
61
  self.version = (version || 1 ) + 1
58
62
  save
@@ -15,6 +15,7 @@ module Rails #:nodoc:
15
15
  #
16
16
  # @since 2.1.0
17
17
  def create_indexes(pattern)
18
+ logger = Logger.new($stdout)
18
19
  Dir.glob(pattern).each do |file|
19
20
  logger = Logger.new($stdout)
20
21
  begin
@@ -22,9 +23,14 @@ module Rails #:nodoc:
22
23
  if model
23
24
  model.create_indexes
24
25
  logger.info("Generated indexes for #{model}")
26
+ else
27
+ logger.info("Not a Mongoid parent model: #{file}")
25
28
  end
26
29
  rescue => e
27
- logger.error("ERROR: #{e.message}")
30
+ logger.error %Q{Failed to create indexes for #{model}:
31
+ #{e.class}:#{e.message}
32
+ #{e.backtrace.join("\n")}
33
+ }
28
34
  end
29
35
  end
30
36
  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: 2.3.5
4
+ version: 2.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-22 00:00:00.000000000 Z
12
+ date: 2012-01-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
16
- requirement: &70140286687420 !ruby/object:Gem::Requirement
16
+ requirement: &70168048476500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 3.1.0
21
+ version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70140286687420
24
+ version_requirements: *70168048476500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: tzinfo
27
- requirement: &70140286686940 !ruby/object:Gem::Requirement
27
+ requirement: &70168048475740 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.3.22
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70140286686940
35
+ version_requirements: *70168048475740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mongo
38
- requirement: &70140286686460 !ruby/object:Gem::Requirement
38
+ requirement: &70168048474680 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '1.3'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70140286686460
46
+ version_requirements: *70168048474680
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rdoc
49
- requirement: &70140286685980 !ruby/object:Gem::Requirement
49
+ requirement: &70168048473620 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 3.5.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70140286685980
57
+ version_requirements: *70168048473620
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bson_ext
60
- requirement: &70140286685500 !ruby/object:Gem::Requirement
60
+ requirement: &70168048473140 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '1.3'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70140286685500
68
+ version_requirements: *70168048473140
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mocha
71
- requirement: &70140286685020 !ruby/object:Gem::Requirement
71
+ requirement: &70168048472640 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.9.12
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70140286685020
79
+ version_requirements: *70168048472640
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &70140286684540 !ruby/object:Gem::Requirement
82
+ requirement: &70168048472160 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '2.6'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70140286684540
90
+ version_requirements: *70168048472160
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: watchr
93
- requirement: &70140286684060 !ruby/object:Gem::Requirement
93
+ requirement: &70168048471300 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,7 +98,18 @@ dependencies:
98
98
  version: '0.6'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70140286684060
101
+ version_requirements: *70168048471300
102
+ - !ruby/object:Gem::Dependency
103
+ name: ammeter
104
+ requirement: &70168048470800 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 0.1.3
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *70168048470800
102
113
  description: Mongoid is an ODM (Object Document Mapper) Framework for MongoDB, written
103
114
  in Ruby.
104
115
  email:
@@ -145,6 +156,8 @@ files:
145
156
  - lib/mongoid/collections.rb
146
157
  - lib/mongoid/components.rb
147
158
  - lib/mongoid/config/database.rb
159
+ - lib/mongoid/config/environment.rb
160
+ - lib/mongoid/config/options.rb
148
161
  - lib/mongoid/config/replset_database.rb
149
162
  - lib/mongoid/config.rb
150
163
  - lib/mongoid/contexts/enumerable/sort.rb
@@ -160,6 +173,7 @@ files:
160
173
  - lib/mongoid/criterion/inclusion.rb
161
174
  - lib/mongoid/criterion/inspection.rb
162
175
  - lib/mongoid/criterion/optional.rb
176
+ - lib/mongoid/criterion/scoping.rb
163
177
  - lib/mongoid/criterion/selector.rb
164
178
  - lib/mongoid/cursor.rb
165
179
  - lib/mongoid/default_scope.rb
@@ -177,18 +191,23 @@ files:
177
191
  - lib/mongoid/errors/invalid_type.rb
178
192
  - lib/mongoid/errors/mixed_relations.rb
179
193
  - lib/mongoid/errors/mongoid_error.rb
194
+ - lib/mongoid/errors/no_environment.rb
195
+ - lib/mongoid/errors/scope_overwrite.rb
180
196
  - lib/mongoid/errors/too_many_nested_attribute_records.rb
181
197
  - lib/mongoid/errors/unsaved_document.rb
182
198
  - lib/mongoid/errors/unsupported_version.rb
183
199
  - lib/mongoid/errors/validations.rb
184
200
  - lib/mongoid/errors.rb
201
+ - lib/mongoid/extensions/array/deep_copy.rb
185
202
  - lib/mongoid/extensions/array/deletion.rb
186
203
  - lib/mongoid/extensions/false_class/equality.rb
187
204
  - lib/mongoid/extensions/hash/criteria_helpers.rb
205
+ - lib/mongoid/extensions/hash/deep_copy.rb
188
206
  - lib/mongoid/extensions/hash/scoping.rb
189
207
  - lib/mongoid/extensions/integer/checks.rb
190
208
  - lib/mongoid/extensions/nil/collectionization.rb
191
209
  - lib/mongoid/extensions/object/checks.rb
210
+ - lib/mongoid/extensions/object/deep_copy.rb
192
211
  - lib/mongoid/extensions/object/reflections.rb
193
212
  - lib/mongoid/extensions/object/substitutable.rb
194
213
  - lib/mongoid/extensions/object/yoda.rb
@@ -203,31 +222,31 @@ files:
203
222
  - lib/mongoid/extensions.rb
204
223
  - lib/mongoid/extras.rb
205
224
  - lib/mongoid/factory.rb
225
+ - lib/mongoid/fields/internal/array.rb
226
+ - lib/mongoid/fields/internal/big_decimal.rb
227
+ - lib/mongoid/fields/internal/bignum.rb
228
+ - lib/mongoid/fields/internal/binary.rb
229
+ - lib/mongoid/fields/internal/boolean.rb
230
+ - lib/mongoid/fields/internal/date.rb
231
+ - lib/mongoid/fields/internal/date_time.rb
232
+ - lib/mongoid/fields/internal/fixnum.rb
233
+ - lib/mongoid/fields/internal/float.rb
234
+ - lib/mongoid/fields/internal/foreign_keys/array.rb
235
+ - lib/mongoid/fields/internal/foreign_keys/object.rb
236
+ - lib/mongoid/fields/internal/hash.rb
237
+ - lib/mongoid/fields/internal/integer.rb
238
+ - lib/mongoid/fields/internal/localized.rb
239
+ - lib/mongoid/fields/internal/nil_class.rb
240
+ - lib/mongoid/fields/internal/object.rb
241
+ - lib/mongoid/fields/internal/object_id.rb
242
+ - lib/mongoid/fields/internal/range.rb
243
+ - lib/mongoid/fields/internal/set.rb
244
+ - lib/mongoid/fields/internal/string.rb
245
+ - lib/mongoid/fields/internal/symbol.rb
246
+ - lib/mongoid/fields/internal/time.rb
247
+ - lib/mongoid/fields/internal/time_with_zone.rb
248
+ - lib/mongoid/fields/internal/timekeeping.rb
206
249
  - lib/mongoid/fields/mappings.rb
207
- - lib/mongoid/fields/serializable/array.rb
208
- - lib/mongoid/fields/serializable/big_decimal.rb
209
- - lib/mongoid/fields/serializable/bignum.rb
210
- - lib/mongoid/fields/serializable/binary.rb
211
- - lib/mongoid/fields/serializable/boolean.rb
212
- - lib/mongoid/fields/serializable/date.rb
213
- - lib/mongoid/fields/serializable/date_time.rb
214
- - lib/mongoid/fields/serializable/fixnum.rb
215
- - lib/mongoid/fields/serializable/float.rb
216
- - lib/mongoid/fields/serializable/foreign_keys/array.rb
217
- - lib/mongoid/fields/serializable/foreign_keys/object.rb
218
- - lib/mongoid/fields/serializable/hash.rb
219
- - lib/mongoid/fields/serializable/integer.rb
220
- - lib/mongoid/fields/serializable/localized.rb
221
- - lib/mongoid/fields/serializable/nil_class.rb
222
- - lib/mongoid/fields/serializable/object.rb
223
- - lib/mongoid/fields/serializable/object_id.rb
224
- - lib/mongoid/fields/serializable/range.rb
225
- - lib/mongoid/fields/serializable/set.rb
226
- - lib/mongoid/fields/serializable/string.rb
227
- - lib/mongoid/fields/serializable/symbol.rb
228
- - lib/mongoid/fields/serializable/time.rb
229
- - lib/mongoid/fields/serializable/time_with_zone.rb
230
- - lib/mongoid/fields/serializable/timekeeping.rb
231
250
  - lib/mongoid/fields/serializable.rb
232
251
  - lib/mongoid/fields.rb
233
252
  - lib/mongoid/finders.rb
@@ -327,7 +346,6 @@ files:
327
346
  - lib/mongoid/relations/embedded/in.rb
328
347
  - lib/mongoid/relations/embedded/many.rb
329
348
  - lib/mongoid/relations/embedded/one.rb
330
- - lib/mongoid/relations/embedded/sort.rb
331
349
  - lib/mongoid/relations/macros.rb
332
350
  - lib/mongoid/relations/many.rb
333
351
  - lib/mongoid/relations/metadata.rb
@@ -360,6 +378,7 @@ files:
360
378
  - lib/mongoid/timestamps/updated.rb
361
379
  - lib/mongoid/timestamps.rb
362
380
  - lib/mongoid/validations/associated.rb
381
+ - lib/mongoid/validations/presence.rb
363
382
  - lib/mongoid/validations/uniqueness.rb
364
383
  - lib/mongoid/validations.rb
365
384
  - lib/mongoid/version.rb
@@ -393,7 +412,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
393
412
  version: '0'
394
413
  segments:
395
414
  - 0
396
- hash: 2509135384989613869
415
+ hash: -3374480126099241138
397
416
  required_rubygems_version: !ruby/object:Gem::Requirement
398
417
  none: false
399
418
  requirements: