mongoid 2.1.9 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/CHANGELOG.md +281 -0
  2. data/{README.rdoc → README.md} +24 -14
  3. data/Rakefile +1 -1
  4. data/lib/config/locales/bg.yml +5 -0
  5. data/lib/config/locales/de.yml +5 -0
  6. data/lib/config/locales/en-GB.yml +5 -0
  7. data/lib/config/locales/en.yml +5 -0
  8. data/lib/config/locales/es.yml +3 -0
  9. data/lib/config/locales/fr.yml +5 -0
  10. data/lib/config/locales/hi.yml +5 -0
  11. data/lib/config/locales/hu.yml +5 -0
  12. data/lib/config/locales/id.yml +5 -0
  13. data/lib/config/locales/it.yml +5 -0
  14. data/lib/config/locales/ja.yml +5 -0
  15. data/lib/config/locales/kr.yml +5 -0
  16. data/lib/config/locales/nl.yml +5 -0
  17. data/lib/config/locales/pl.yml +5 -0
  18. data/lib/config/locales/pt-BR.yml +5 -0
  19. data/lib/config/locales/pt.yml +5 -0
  20. data/lib/config/locales/ro.yml +5 -0
  21. data/lib/config/locales/ru.yml +5 -0
  22. data/lib/config/locales/sv.yml +5 -0
  23. data/lib/config/locales/vi.yml +5 -0
  24. data/lib/config/locales/zh-CN.yml +5 -0
  25. data/lib/mongoid/atomic.rb +61 -10
  26. data/lib/mongoid/atomic/modifiers.rb +156 -24
  27. data/lib/mongoid/attributes.rb +38 -10
  28. data/lib/mongoid/collection.rb +21 -3
  29. data/lib/mongoid/collections.rb +52 -6
  30. data/lib/mongoid/collections/master.rb +8 -2
  31. data/lib/mongoid/collections/operations.rb +1 -0
  32. data/lib/mongoid/config.rb +5 -2
  33. data/lib/mongoid/config/database.rb +15 -2
  34. data/lib/mongoid/contexts/mongo.rb +3 -0
  35. data/lib/mongoid/criteria.rb +27 -3
  36. data/lib/mongoid/criterion/inclusion.rb +58 -0
  37. data/lib/mongoid/dirty.rb +2 -0
  38. data/lib/mongoid/document.rb +23 -0
  39. data/lib/mongoid/errors.rb +3 -0
  40. data/lib/mongoid/errors/callback.rb +26 -0
  41. data/lib/mongoid/errors/eager_load.rb +25 -0
  42. data/lib/mongoid/errors/invalid_find.rb +19 -0
  43. data/lib/mongoid/extensions.rb +3 -1
  44. data/lib/mongoid/extensions/object_id/conversions.rb +1 -1
  45. data/lib/mongoid/extras.rb +12 -2
  46. data/lib/mongoid/fields.rb +41 -2
  47. data/lib/mongoid/fields/serializable.rb +36 -0
  48. data/lib/mongoid/fields/serializable/foreign_keys/array.rb +13 -14
  49. data/lib/mongoid/fields/serializable/foreign_keys/object.rb +13 -14
  50. data/lib/mongoid/finders.rb +4 -4
  51. data/lib/mongoid/identity_map.rb +33 -20
  52. data/lib/mongoid/keys.rb +24 -1
  53. data/lib/mongoid/nested_attributes.rb +16 -4
  54. data/lib/mongoid/persistence.rb +50 -6
  55. data/lib/mongoid/persistence/operations.rb +1 -4
  56. data/lib/mongoid/persistence/operations/update.rb +3 -1
  57. data/lib/mongoid/relations/builders/nested_attributes/many.rb +27 -44
  58. data/lib/mongoid/relations/builders/referenced/many.rb +2 -1
  59. data/lib/mongoid/relations/builders/referenced/one.rb +1 -1
  60. data/lib/mongoid/relations/cascading.rb +12 -1
  61. data/lib/mongoid/relations/embedded/many.rb +11 -4
  62. data/lib/mongoid/relations/embedded/one.rb +6 -2
  63. data/lib/mongoid/relations/macros.rb +19 -12
  64. data/lib/mongoid/relations/metadata.rb +17 -0
  65. data/lib/mongoid/relations/polymorphic.rb +12 -1
  66. data/lib/mongoid/relations/proxy.rb +24 -0
  67. data/lib/mongoid/relations/referenced/in.rb +20 -0
  68. data/lib/mongoid/relations/referenced/many.rb +30 -6
  69. data/lib/mongoid/relations/referenced/many_to_many.rb +18 -2
  70. data/lib/mongoid/relations/referenced/one.rb +19 -0
  71. data/lib/mongoid/relations/reflections.rb +23 -3
  72. data/lib/mongoid/relations/targets/enumerable.rb +29 -1
  73. data/lib/mongoid/serialization.rb +1 -1
  74. data/lib/mongoid/sharding.rb +12 -2
  75. data/lib/mongoid/threaded.rb +98 -0
  76. data/lib/mongoid/version.rb +1 -1
  77. data/lib/mongoid/versioning.rb +12 -2
  78. metadata +25 -21
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Mongoid #:nodoc
3
- VERSION = "2.1.9"
3
+ VERSION = "2.2.0"
4
4
  end
@@ -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.1.9
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-21 00:00:00.000000000Z
12
+ date: 2011-08-28 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
16
- requirement: &70212863380720 !ruby/object:Gem::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: *70212863380720
24
+ version_requirements: *70328311594300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: tzinfo
27
- requirement: &70212863379760 !ruby/object:Gem::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: *70212863379760
35
+ version_requirements: *70328311593640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mongo
38
- requirement: &70212863378720 !ruby/object:Gem::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: *70212863378720
46
+ version_requirements: *70328311593000
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rdoc
49
- requirement: &70212863378060 !ruby/object:Gem::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: *70212863378060
57
+ version_requirements: *70328311587860
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bson_ext
60
- requirement: &70212863377500 !ruby/object:Gem::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: *70212863377500
68
+ version_requirements: *70328311586580
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mocha
71
- requirement: &70212863376960 !ruby/object:Gem::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.8
76
+ version: 0.9.12
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70212863376960
79
+ version_requirements: *70328311585580
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &70212863376320 !ruby/object:Gem::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: *70212863376320
90
+ version_requirements: *70328311584820
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: watchr
93
- requirement: &70212863375660 !ruby/object:Gem::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: *70212863375660
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.rdoc
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: 4312449490515662776
387
+ hash: -3524092560403003003
384
388
  required_rubygems_version: !ruby/object:Gem::Requirement
385
389
  none: false
386
390
  requirements: