mongoid 2.1.9 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +281 -0
- data/{README.rdoc → README.md} +24 -14
- data/Rakefile +1 -1
- data/lib/config/locales/bg.yml +5 -0
- data/lib/config/locales/de.yml +5 -0
- data/lib/config/locales/en-GB.yml +5 -0
- data/lib/config/locales/en.yml +5 -0
- data/lib/config/locales/es.yml +3 -0
- data/lib/config/locales/fr.yml +5 -0
- data/lib/config/locales/hi.yml +5 -0
- data/lib/config/locales/hu.yml +5 -0
- data/lib/config/locales/id.yml +5 -0
- data/lib/config/locales/it.yml +5 -0
- data/lib/config/locales/ja.yml +5 -0
- data/lib/config/locales/kr.yml +5 -0
- data/lib/config/locales/nl.yml +5 -0
- data/lib/config/locales/pl.yml +5 -0
- data/lib/config/locales/pt-BR.yml +5 -0
- data/lib/config/locales/pt.yml +5 -0
- data/lib/config/locales/ro.yml +5 -0
- data/lib/config/locales/ru.yml +5 -0
- data/lib/config/locales/sv.yml +5 -0
- data/lib/config/locales/vi.yml +5 -0
- data/lib/config/locales/zh-CN.yml +5 -0
- data/lib/mongoid/atomic.rb +61 -10
- data/lib/mongoid/atomic/modifiers.rb +156 -24
- data/lib/mongoid/attributes.rb +38 -10
- data/lib/mongoid/collection.rb +21 -3
- data/lib/mongoid/collections.rb +52 -6
- data/lib/mongoid/collections/master.rb +8 -2
- data/lib/mongoid/collections/operations.rb +1 -0
- data/lib/mongoid/config.rb +5 -2
- data/lib/mongoid/config/database.rb +15 -2
- data/lib/mongoid/contexts/mongo.rb +3 -0
- data/lib/mongoid/criteria.rb +27 -3
- data/lib/mongoid/criterion/inclusion.rb +58 -0
- data/lib/mongoid/dirty.rb +2 -0
- data/lib/mongoid/document.rb +23 -0
- data/lib/mongoid/errors.rb +3 -0
- data/lib/mongoid/errors/callback.rb +26 -0
- data/lib/mongoid/errors/eager_load.rb +25 -0
- data/lib/mongoid/errors/invalid_find.rb +19 -0
- data/lib/mongoid/extensions.rb +3 -1
- data/lib/mongoid/extensions/object_id/conversions.rb +1 -1
- data/lib/mongoid/extras.rb +12 -2
- data/lib/mongoid/fields.rb +41 -2
- data/lib/mongoid/fields/serializable.rb +36 -0
- data/lib/mongoid/fields/serializable/foreign_keys/array.rb +13 -14
- data/lib/mongoid/fields/serializable/foreign_keys/object.rb +13 -14
- data/lib/mongoid/finders.rb +4 -4
- data/lib/mongoid/identity_map.rb +33 -20
- data/lib/mongoid/keys.rb +24 -1
- data/lib/mongoid/nested_attributes.rb +16 -4
- data/lib/mongoid/persistence.rb +50 -6
- data/lib/mongoid/persistence/operations.rb +1 -4
- data/lib/mongoid/persistence/operations/update.rb +3 -1
- data/lib/mongoid/relations/builders/nested_attributes/many.rb +27 -44
- data/lib/mongoid/relations/builders/referenced/many.rb +2 -1
- data/lib/mongoid/relations/builders/referenced/one.rb +1 -1
- data/lib/mongoid/relations/cascading.rb +12 -1
- data/lib/mongoid/relations/embedded/many.rb +11 -4
- data/lib/mongoid/relations/embedded/one.rb +6 -2
- data/lib/mongoid/relations/macros.rb +19 -12
- data/lib/mongoid/relations/metadata.rb +17 -0
- data/lib/mongoid/relations/polymorphic.rb +12 -1
- data/lib/mongoid/relations/proxy.rb +24 -0
- data/lib/mongoid/relations/referenced/in.rb +20 -0
- data/lib/mongoid/relations/referenced/many.rb +30 -6
- data/lib/mongoid/relations/referenced/many_to_many.rb +18 -2
- data/lib/mongoid/relations/referenced/one.rb +19 -0
- data/lib/mongoid/relations/reflections.rb +23 -3
- data/lib/mongoid/relations/targets/enumerable.rb +29 -1
- data/lib/mongoid/serialization.rb +1 -1
- data/lib/mongoid/sharding.rb +12 -2
- data/lib/mongoid/threaded.rb +98 -0
- data/lib/mongoid/version.rb +1 -1
- data/lib/mongoid/versioning.rb +12 -2
- metadata +25 -21
data/lib/mongoid/version.rb
CHANGED
data/lib/mongoid/versioning.rb
CHANGED
@@ -7,8 +7,6 @@ module Mongoid #:nodoc:
|
|
7
7
|
module Versioning
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
10
|
-
delegate :version_max, :to => "self.class"
|
11
|
-
|
12
10
|
included do
|
13
11
|
field :version, :type => Integer, :default => 1
|
14
12
|
|
@@ -25,6 +23,18 @@ module Mongoid #:nodoc:
|
|
25
23
|
self.cyclic = true
|
26
24
|
end
|
27
25
|
|
26
|
+
# Get the maximum number of versions to store.
|
27
|
+
#
|
28
|
+
# @note Refactored from using delegate for class load performance.
|
29
|
+
#
|
30
|
+
# @example Get the max versions.
|
31
|
+
# model.version_max
|
32
|
+
#
|
33
|
+
# @return [ Integer ] The max number of versions.
|
34
|
+
def version_max
|
35
|
+
self.class.version_max
|
36
|
+
end
|
37
|
+
|
28
38
|
# Create a new version of the +Document+. This will load the previous
|
29
39
|
# document from the database and set it as the next version before saving
|
30
40
|
# the current document. It then increments the version number. If a #max_versions
|
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.
|
4
|
+
version: 2.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-08-
|
12
|
+
date: 2011-08-28 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
16
|
-
requirement: &
|
16
|
+
requirement: &70328311594300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70328311594300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: tzinfo
|
27
|
-
requirement: &
|
27
|
+
requirement: &70328311593640 !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: *
|
35
|
+
version_requirements: *70328311593640
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: mongo
|
38
|
-
requirement: &
|
38
|
+
requirement: &70328311593000 !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: *
|
46
|
+
version_requirements: *70328311593000
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rdoc
|
49
|
-
requirement: &
|
49
|
+
requirement: &70328311587860 !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: *
|
57
|
+
version_requirements: *70328311587860
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bson_ext
|
60
|
-
requirement: &
|
60
|
+
requirement: &70328311586580 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,21 +65,21 @@ dependencies:
|
|
65
65
|
version: '1.3'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70328311586580
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: mocha
|
71
|
-
requirement: &
|
71
|
+
requirement: &70328311585580 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0.9.
|
76
|
+
version: 0.9.12
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70328311585580
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rspec
|
82
|
-
requirement: &
|
82
|
+
requirement: &70328311584820 !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: *
|
90
|
+
version_requirements: *70328311584820
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: watchr
|
93
|
-
requirement: &
|
93
|
+
requirement: &70328311583660 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '0.6'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70328311583660
|
102
102
|
description: Mongoid is an ODM (Object Document Mapper) Framework for MongoDB, written
|
103
103
|
in Ruby.
|
104
104
|
email:
|
@@ -166,10 +166,13 @@ files:
|
|
166
166
|
- lib/mongoid/default_scope.rb
|
167
167
|
- lib/mongoid/dirty.rb
|
168
168
|
- lib/mongoid/document.rb
|
169
|
+
- lib/mongoid/errors/callback.rb
|
169
170
|
- lib/mongoid/errors/document_not_found.rb
|
171
|
+
- lib/mongoid/errors/eager_load.rb
|
170
172
|
- lib/mongoid/errors/invalid_collection.rb
|
171
173
|
- lib/mongoid/errors/invalid_database.rb
|
172
174
|
- lib/mongoid/errors/invalid_field.rb
|
175
|
+
- lib/mongoid/errors/invalid_find.rb
|
173
176
|
- lib/mongoid/errors/invalid_options.rb
|
174
177
|
- lib/mongoid/errors/invalid_type.rb
|
175
178
|
- lib/mongoid/errors/mixed_relations.rb
|
@@ -363,8 +366,9 @@ files:
|
|
363
366
|
- lib/rails/generators/mongoid/observer/templates/observer.rb.tt
|
364
367
|
- lib/rails/generators/mongoid_generator.rb
|
365
368
|
- lib/rails/mongoid.rb
|
369
|
+
- CHANGELOG.md
|
366
370
|
- LICENSE
|
367
|
-
- README.
|
371
|
+
- README.md
|
368
372
|
- Rakefile
|
369
373
|
homepage: http://mongoid.org
|
370
374
|
licenses: []
|
@@ -380,7 +384,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
380
384
|
version: '0'
|
381
385
|
segments:
|
382
386
|
- 0
|
383
|
-
hash:
|
387
|
+
hash: -3524092560403003003
|
384
388
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
385
389
|
none: false
|
386
390
|
requirements:
|