chhean-mongoid 2.0.1.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. data/MIT_LICENSE +20 -0
  2. data/README.rdoc +49 -0
  3. data/lib/mongoid.rb +139 -0
  4. data/lib/mongoid/associations.rb +327 -0
  5. data/lib/mongoid/associations/embedded_in.rb +72 -0
  6. data/lib/mongoid/associations/embeds_many.rb +262 -0
  7. data/lib/mongoid/associations/embeds_one.rb +95 -0
  8. data/lib/mongoid/associations/foreign_key.rb +35 -0
  9. data/lib/mongoid/associations/meta_data.rb +29 -0
  10. data/lib/mongoid/associations/options.rb +73 -0
  11. data/lib/mongoid/associations/proxy.rb +33 -0
  12. data/lib/mongoid/associations/referenced_in.rb +71 -0
  13. data/lib/mongoid/associations/references_many.rb +243 -0
  14. data/lib/mongoid/associations/references_many_as_array.rb +78 -0
  15. data/lib/mongoid/associations/references_one.rb +116 -0
  16. data/lib/mongoid/attributes.rb +226 -0
  17. data/lib/mongoid/callbacks.rb +17 -0
  18. data/lib/mongoid/collection.rb +120 -0
  19. data/lib/mongoid/collections.rb +41 -0
  20. data/lib/mongoid/collections/cyclic_iterator.rb +34 -0
  21. data/lib/mongoid/collections/master.rb +29 -0
  22. data/lib/mongoid/collections/operations.rb +41 -0
  23. data/lib/mongoid/collections/slaves.rb +45 -0
  24. data/lib/mongoid/components.rb +32 -0
  25. data/lib/mongoid/config.rb +237 -0
  26. data/lib/mongoid/contexts.rb +24 -0
  27. data/lib/mongoid/contexts/enumerable.rb +151 -0
  28. data/lib/mongoid/contexts/ids.rb +25 -0
  29. data/lib/mongoid/contexts/mongo.rb +285 -0
  30. data/lib/mongoid/contexts/paging.rb +50 -0
  31. data/lib/mongoid/criteria.rb +230 -0
  32. data/lib/mongoid/criterion/complex.rb +21 -0
  33. data/lib/mongoid/criterion/exclusion.rb +65 -0
  34. data/lib/mongoid/criterion/inclusion.rb +110 -0
  35. data/lib/mongoid/criterion/optional.rb +136 -0
  36. data/lib/mongoid/cursor.rb +82 -0
  37. data/lib/mongoid/deprecation.rb +22 -0
  38. data/lib/mongoid/dirty.rb +254 -0
  39. data/lib/mongoid/document.rb +264 -0
  40. data/lib/mongoid/errors.rb +124 -0
  41. data/lib/mongoid/extensions.rb +106 -0
  42. data/lib/mongoid/extensions/array/accessors.rb +17 -0
  43. data/lib/mongoid/extensions/array/aliasing.rb +4 -0
  44. data/lib/mongoid/extensions/array/assimilation.rb +26 -0
  45. data/lib/mongoid/extensions/array/conversions.rb +27 -0
  46. data/lib/mongoid/extensions/array/parentization.rb +13 -0
  47. data/lib/mongoid/extensions/big_decimal/conversions.rb +19 -0
  48. data/lib/mongoid/extensions/binary/conversions.rb +17 -0
  49. data/lib/mongoid/extensions/boolean/conversions.rb +22 -0
  50. data/lib/mongoid/extensions/date/conversions.rb +24 -0
  51. data/lib/mongoid/extensions/datetime/conversions.rb +12 -0
  52. data/lib/mongoid/extensions/float/conversions.rb +20 -0
  53. data/lib/mongoid/extensions/hash/accessors.rb +38 -0
  54. data/lib/mongoid/extensions/hash/assimilation.rb +39 -0
  55. data/lib/mongoid/extensions/hash/conversions.rb +45 -0
  56. data/lib/mongoid/extensions/hash/criteria_helpers.rb +20 -0
  57. data/lib/mongoid/extensions/hash/scoping.rb +12 -0
  58. data/lib/mongoid/extensions/integer/conversions.rb +20 -0
  59. data/lib/mongoid/extensions/nil/assimilation.rb +17 -0
  60. data/lib/mongoid/extensions/object/conversions.rb +27 -0
  61. data/lib/mongoid/extensions/objectid/conversions.rb +15 -0
  62. data/lib/mongoid/extensions/proc/scoping.rb +12 -0
  63. data/lib/mongoid/extensions/set/conversions.rb +20 -0
  64. data/lib/mongoid/extensions/string/conversions.rb +15 -0
  65. data/lib/mongoid/extensions/string/inflections.rb +97 -0
  66. data/lib/mongoid/extensions/symbol/inflections.rb +39 -0
  67. data/lib/mongoid/extensions/time_conversions.rb +35 -0
  68. data/lib/mongoid/extras.rb +61 -0
  69. data/lib/mongoid/factory.rb +20 -0
  70. data/lib/mongoid/field.rb +80 -0
  71. data/lib/mongoid/fields.rb +61 -0
  72. data/lib/mongoid/finders.rb +144 -0
  73. data/lib/mongoid/identity.rb +39 -0
  74. data/lib/mongoid/indexes.rb +27 -0
  75. data/lib/mongoid/javascript.rb +21 -0
  76. data/lib/mongoid/javascript/functions.yml +37 -0
  77. data/lib/mongoid/matchers.rb +35 -0
  78. data/lib/mongoid/matchers/all.rb +11 -0
  79. data/lib/mongoid/matchers/default.rb +26 -0
  80. data/lib/mongoid/matchers/exists.rb +13 -0
  81. data/lib/mongoid/matchers/gt.rb +11 -0
  82. data/lib/mongoid/matchers/gte.rb +11 -0
  83. data/lib/mongoid/matchers/in.rb +11 -0
  84. data/lib/mongoid/matchers/lt.rb +11 -0
  85. data/lib/mongoid/matchers/lte.rb +11 -0
  86. data/lib/mongoid/matchers/ne.rb +11 -0
  87. data/lib/mongoid/matchers/nin.rb +11 -0
  88. data/lib/mongoid/matchers/size.rb +11 -0
  89. data/lib/mongoid/memoization.rb +33 -0
  90. data/lib/mongoid/named_scope.rb +37 -0
  91. data/lib/mongoid/observable.rb +30 -0
  92. data/lib/mongoid/paths.rb +62 -0
  93. data/lib/mongoid/persistence.rb +218 -0
  94. data/lib/mongoid/persistence/command.rb +39 -0
  95. data/lib/mongoid/persistence/insert.rb +47 -0
  96. data/lib/mongoid/persistence/insert_embedded.rb +38 -0
  97. data/lib/mongoid/persistence/remove.rb +39 -0
  98. data/lib/mongoid/persistence/remove_all.rb +37 -0
  99. data/lib/mongoid/persistence/remove_embedded.rb +50 -0
  100. data/lib/mongoid/persistence/update.rb +63 -0
  101. data/lib/mongoid/railtie.rb +54 -0
  102. data/lib/mongoid/railties/database.rake +37 -0
  103. data/lib/mongoid/scope.rb +75 -0
  104. data/lib/mongoid/state.rb +32 -0
  105. data/lib/mongoid/timestamps.rb +27 -0
  106. data/lib/mongoid/validations.rb +51 -0
  107. data/lib/mongoid/validations/associated.rb +32 -0
  108. data/lib/mongoid/validations/locale/en.yml +4 -0
  109. data/lib/mongoid/validations/uniqueness.rb +50 -0
  110. data/lib/mongoid/version.rb +4 -0
  111. data/lib/mongoid/versioning.rb +27 -0
  112. data/lib/rails/generators/mongoid/config/config_generator.rb +41 -0
  113. data/lib/rails/generators/mongoid/config/templates/mongoid.yml +24 -0
  114. data/lib/rails/generators/mongoid/model/model_generator.rb +24 -0
  115. data/lib/rails/generators/mongoid/model/templates/model.rb +15 -0
  116. data/lib/rails/generators/mongoid_generator.rb +61 -0
  117. metadata +284 -0
@@ -0,0 +1,264 @@
1
+ # encoding: utf-8
2
+ module Mongoid #:nodoc:
3
+ module Document
4
+ extend ActiveSupport::Concern
5
+ included do
6
+ include Mongoid::Components
7
+
8
+ cattr_accessor :primary_key, :hereditary, :attr_accessible_list, :attr_protected_list
9
+ self.hereditary = false
10
+ self.attr_accessible_list = []
11
+ self.attr_protected_list = []
12
+
13
+ attr_accessor :association_name, :_parent
14
+ attr_reader :new_record
15
+
16
+ delegate :db, :primary_key, :to => "self.class"
17
+ end
18
+
19
+ module ClassMethods
20
+ # Return the database associated with this class.
21
+ def db
22
+ collection.db
23
+ end
24
+
25
+ # Perform default behavior but mark the hierarchy as being hereditary.
26
+ def inherited(subclass)
27
+ super(subclass)
28
+ self.hereditary = true
29
+ end
30
+
31
+ # Instantiate a new object, only when loaded from the database or when
32
+ # the attributes have already been typecast.
33
+ #
34
+ # Example:
35
+ #
36
+ # <tt>Person.instantiate(:title => "Sir", :age => 30)</tt>
37
+ def instantiate(attrs = nil, allocating = false)
38
+ attributes = attrs || {}
39
+ if attributes["_id"] || allocating
40
+ document = allocate
41
+ document.instance_variable_set(:@attributes, attributes)
42
+ document.setup_modifications
43
+ return document
44
+ else
45
+ return new(attrs)
46
+ end
47
+ end
48
+
49
+ # Defines the field that will be used for the id of this +Document+. This
50
+ # set the id of this +Document+ before save to a parameterized version of
51
+ # the field that was supplied. This is good for use for readable URLS in
52
+ # web applications.
53
+ #
54
+ # Example:
55
+ #
56
+ # class Person
57
+ # include Mongoid::Document
58
+ # key :first_name, :last_name
59
+ # end
60
+ def key(*fields)
61
+ self.primary_key = fields
62
+ set_callback :save, :before, :identify
63
+ end
64
+
65
+ # Returns all types to query for when using this class as the base.
66
+ # *subclasses* is from activesupport. Note that a bug in *subclasses*
67
+ # causes the first call to only return direct children, hence
68
+ # the double call and unique.
69
+ def _types
70
+ @_type ||= [subclasses + subclasses + [self.name]].flatten.uniq
71
+ end
72
+
73
+ # sets list of attributes to be accessible
74
+ def attr_accessible(*args)
75
+ self.attr_accessible_list += args.map(&:to_sym)
76
+ end
77
+
78
+ # sets list of attributes to be protected
79
+ def attr_protected(*args)
80
+ self.attr_protected_list += args.map(&:to_sym)
81
+ end
82
+ end
83
+
84
+ module InstanceMethods
85
+ # Performs equality checking on the document ids. For more robust
86
+ # equality checking please override this method.
87
+ def ==(other)
88
+ return false unless other.is_a?(Document)
89
+ id == other.id
90
+ end
91
+
92
+ # Delegates to ==
93
+ def eql?(comparison_object)
94
+ self == (comparison_object)
95
+ end
96
+
97
+ # Delegates to id in order to allow two records of the same type and id to work with something like:
98
+ # [ Person.find(1), Person.find(2), Person.find(3) ] & [ Person.find(1), Person.find(4) ] # => [ Person.find(1) ]
99
+ def hash
100
+ id.hash
101
+ end
102
+
103
+ # Is inheritance in play here?
104
+ #
105
+ # Returns:
106
+ #
107
+ # <tt>true</tt> if inheritance used, <tt>false</tt> if not.
108
+ def hereditary?
109
+ !!self.hereditary
110
+ end
111
+
112
+ # Introduces a child object into the +Document+ object graph. This will
113
+ # set up the relationships between the parent and child and update the
114
+ # attributes of the parent +Document+.
115
+ #
116
+ # Options:
117
+ #
118
+ # parent: The +Document+ to assimilate with.
119
+ # options: The association +Options+ for the child.
120
+ def assimilate(parent, options)
121
+ parentize(parent, options.name); notify; self
122
+ end
123
+
124
+ # Return the attributes hash with indifferent access.
125
+ def attributes
126
+ @attributes.with_indifferent_access
127
+ end
128
+
129
+ # Clone the current +Document+. This will return all attributes with the
130
+ # exception of the document's id and versions.
131
+ def clone
132
+ self.class.instantiate(@attributes.except("_id").except("versions").dup, true)
133
+ end
134
+
135
+ # Generate an id for this +Document+.
136
+ def identify
137
+ Identity.create(self)
138
+ end
139
+
140
+ # Instantiate a new +Document+, setting the Document's attributes if
141
+ # given. If no attributes are provided, they will be initialized with
142
+ # an empty +Hash+.
143
+ #
144
+ # If a primary key is defined, the document's id will be set to that key,
145
+ # otherwise it will be set to a fresh +BSON::ObjectID+ string.
146
+ #
147
+ # Options:
148
+ #
149
+ # attrs: The attributes +Hash+ to set up the document with.
150
+ def initialize(attrs = nil)
151
+ @attributes = default_attributes
152
+ process(attrs)
153
+ @new_record = true
154
+ document = yield self if block_given?
155
+ identify
156
+ end
157
+
158
+ # Returns the class name plus its attributes.
159
+ def inspect
160
+ attrs = fields.map { |name, field| "#{name}: #{@attributes[name].inspect}" }
161
+ if Mongoid.allow_dynamic_fields
162
+ dynamic_keys = @attributes.keys - fields.keys - associations.keys - ["_id", "_type"]
163
+ attrs += dynamic_keys.map { |name| "#{name}: #{@attributes[name].inspect}" }
164
+ end
165
+ "#<#{self.class.name} _id: #{id}, #{attrs * ', '}>"
166
+ end
167
+
168
+ # Notify observers of an update.
169
+ #
170
+ # Example:
171
+ #
172
+ # <tt>person.notify</tt>
173
+ def notify
174
+ notify_observers(self)
175
+ end
176
+
177
+ # Sets up a child/parent association. This is used for newly created
178
+ # objects so they can be properly added to the graph and have the parent
179
+ # observers set up properly.
180
+ #
181
+ # Options:
182
+ #
183
+ # abject: The parent object that needs to be set for the child.
184
+ # association_name: The name of the association for the child.
185
+ #
186
+ # Example:
187
+ #
188
+ # <tt>address.parentize(person, :addresses)</tt>
189
+ def parentize(object, association_name)
190
+ self._parent = object
191
+ self.association_name = association_name.to_s
192
+ add_observer(object)
193
+ end
194
+
195
+ # Return the attributes hash.
196
+ def raw_attributes
197
+ @attributes
198
+ end
199
+
200
+ # Reloads the +Document+ attributes from the database.
201
+ def reload
202
+ reloaded = collection.find_one(:_id => id)
203
+ if Mongoid.raise_not_found_error
204
+ raise Errors::DocumentNotFound.new(self.class, id) if reloaded.nil?
205
+ end
206
+ @attributes = {}.merge(reloaded || {})
207
+ self.associations.keys.each { |association_name| unmemoize(association_name) }; self
208
+ end
209
+
210
+ # Remove a child document from this parent +Document+. Will reset the
211
+ # memoized association and notify the parent of the change.
212
+ def remove(child)
213
+ name = child.association_name
214
+ reset(name) { @attributes.remove(name, child.raw_attributes) }
215
+ notify
216
+ end
217
+
218
+ # Return the root +Document+ in the object graph. If the current +Document+
219
+ # is the root object in the graph it will return self.
220
+ def _root
221
+ object = self
222
+ while (object._parent) do object = object._parent; end
223
+ object || self
224
+ end
225
+
226
+ # Return an array with this +Document+ only in it.
227
+ def to_a
228
+ [ self ]
229
+ end
230
+
231
+ # Returns nil if document is new, or an array of primary keys if not.
232
+ def to_key
233
+ new_record? ? nil : [ id ]
234
+ end
235
+
236
+ # Returns the id of the Document, used in Rails compatibility.
237
+ def to_param
238
+ id
239
+ end
240
+
241
+ # Observe a notify call from a child +Document+. This will either update
242
+ # existing attributes on the +Document+ or clear them out for the child if
243
+ # the clear boolean is provided.
244
+ #
245
+ # Options:
246
+ #
247
+ # child: The child +Document+ that sent the notification.
248
+ # clear: Will clear out the child's attributes if set to true.
249
+ #
250
+ # This will also cause the observing +Document+ to notify it's parent if
251
+ # there is any.
252
+ def observe(child, clear = false)
253
+ name = child.association_name
254
+ attrs = child.instance_variable_get(:@attributes)
255
+ if clear
256
+ @attributes.delete(name)
257
+ else
258
+ @attributes.insert(name, attrs) unless @attributes[name] && @attributes[name].include?(attrs)
259
+ end
260
+ notify
261
+ end
262
+ end
263
+ end
264
+ end
@@ -0,0 +1,124 @@
1
+ # encoding: utf-8
2
+ module Mongoid #:nodoc
3
+ module Errors #:nodoc
4
+
5
+ # Raised when querying the database for a document by a specific id which
6
+ # does not exist. If multiple ids were passed then it will display all of
7
+ # those.
8
+ #
9
+ # Example:
10
+ #
11
+ # <tt>DocumentNotFound.new(Person, ["1", "2"])</tt>
12
+ class DocumentNotFound < RuntimeError
13
+ def initialize(klass, ids)
14
+ @klass, @identifier = klass, ids.is_a?(Array) ? ids.join(", ") : ids
15
+ end
16
+ def message
17
+ "Document not found for class #{@klass} and id(s) #{@identifier}"
18
+ end
19
+ end
20
+
21
+ # Raised when invalid options are passed into a constructor or method.
22
+ #
23
+ # Example:
24
+ #
25
+ # <tt>InvalidOptions.new</tt>
26
+ class InvalidOptions < RuntimeError; end
27
+
28
+ # Raised when the database connection has not been set up properly, either
29
+ # by attempting to set an object on the db that is not a +Mongo::DB+, or
30
+ # not setting anything at all.
31
+ #
32
+ # Example:
33
+ #
34
+ # <tt>InvalidDatabase.new("Not a DB")</tt>
35
+ class InvalidDatabase < RuntimeError
36
+ def initialize(database)
37
+ @database = database
38
+ end
39
+ def message
40
+ "Database should be a Mongo::DB, not #{@database.class.name}"
41
+ end
42
+ end
43
+
44
+ # Raised when the database version is not supported by Mongoid.
45
+ #
46
+ # Example:
47
+ #
48
+ # <tt>UnsupportedVersion.new(Mongo::ServerVersion.new("1.3.1"))</tt>
49
+ class UnsupportedVersion < RuntimeError
50
+ def initialize(version)
51
+ @version = version
52
+ end
53
+ def message
54
+ "MongoDB #{@version} not supported, please upgrade to #{Mongoid::MONGODB_VERSION}"
55
+ end
56
+ end
57
+
58
+ # Raised when a persisence method ending in ! fails validation. The message
59
+ # will contain the full error messages from the +Document+ in question.
60
+ #
61
+ # Example:
62
+ #
63
+ # <tt>Validations.new(person.errors)</tt>
64
+ class Validations < RuntimeError
65
+ def initialize(errors)
66
+ @errors = errors
67
+ end
68
+ def message
69
+ "Validation Failed: " + @errors.full_messages.join(", ")
70
+ end
71
+ end
72
+
73
+ # This error is raised when trying to access a Mongo::Collection from an
74
+ # embedded document.
75
+ #
76
+ # Example:
77
+ #
78
+ # <tt>InvalidCollection.new(Address)</tt>
79
+ class InvalidCollection < RuntimeError
80
+ def initialize(klass)
81
+ @klass = klass
82
+ end
83
+ def message
84
+ "Access to the collection for #{@klass.name} is not allowed " +
85
+ "since it is an embedded document, please access a collection from " +
86
+ "the root document"
87
+ end
88
+ end
89
+
90
+ # This error is raised when trying to create a field that conflicts with
91
+ # a Mongoid internal attribute or method.
92
+ #
93
+ # Example:
94
+ #
95
+ # <tt>InvalidField.new('collection')</tt>
96
+ class InvalidField < RuntimeError
97
+ def initialize(name)
98
+ @name = name
99
+ end
100
+ def message
101
+ "Defining a field named '#{@name}' is not allowed. " +
102
+ "Do not define fields that conflict with Mongoid internal attributes " +
103
+ "or method names. Use Document#instance_methods to see what " +
104
+ "names this includes."
105
+ end
106
+ end
107
+
108
+ # This error is raised when trying to create set nested records above the
109
+ # specified :limit
110
+ #
111
+ # Example:
112
+ #
113
+ #<tt>TooManyNestedAttributeRecords.new('association', limit)
114
+ class TooManyNestedAttributeRecords < RuntimeError
115
+ def initialize(association, limit)
116
+ @association = association.to_s.humanize.capitalize
117
+ @limit = limit
118
+ end
119
+ def message
120
+ "Accept Nested Attributes for #{@association} is limited to #{@limit} records"
121
+ end
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,106 @@
1
+ # encoding: utf-8
2
+ require "mongoid/extensions/time_conversions"
3
+ require "mongoid/extensions/array/accessors"
4
+ require "mongoid/extensions/array/aliasing"
5
+ require "mongoid/extensions/array/assimilation"
6
+ require "mongoid/extensions/array/conversions"
7
+ require "mongoid/extensions/array/parentization"
8
+ require "mongoid/extensions/set/conversions"
9
+ require "mongoid/extensions/big_decimal/conversions"
10
+ require "mongoid/extensions/binary/conversions"
11
+ require "mongoid/extensions/boolean/conversions"
12
+ require "mongoid/extensions/date/conversions"
13
+ require "mongoid/extensions/datetime/conversions"
14
+ require "mongoid/extensions/float/conversions"
15
+ require "mongoid/extensions/hash/accessors"
16
+ require "mongoid/extensions/hash/assimilation"
17
+ require "mongoid/extensions/hash/conversions"
18
+ require "mongoid/extensions/hash/criteria_helpers"
19
+ require "mongoid/extensions/hash/scoping"
20
+ require "mongoid/extensions/integer/conversions"
21
+ require "mongoid/extensions/nil/assimilation"
22
+ require "mongoid/extensions/object/conversions"
23
+ require "mongoid/extensions/proc/scoping"
24
+ require "mongoid/extensions/string/conversions"
25
+ require "mongoid/extensions/string/inflections"
26
+ require "mongoid/extensions/symbol/inflections"
27
+ require "mongoid/extensions/objectid/conversions"
28
+
29
+ class Array #:nodoc
30
+ include Mongoid::Extensions::Array::Accessors
31
+ include Mongoid::Extensions::Array::Assimilation
32
+ include Mongoid::Extensions::Array::Conversions
33
+ include Mongoid::Extensions::Array::Parentization
34
+ end
35
+
36
+ class Set #:nodoc
37
+ include Mongoid::Extensions::Set::Conversions
38
+ end
39
+
40
+ class BigDecimal #:nodoc
41
+ extend Mongoid::Extensions::BigDecimal::Conversions
42
+ end
43
+
44
+ class Binary #:nodoc
45
+ extend Mongoid::Extensions::Binary::Conversions
46
+ end
47
+
48
+ class Boolean #:nodoc
49
+ extend Mongoid::Extensions::Boolean::Conversions
50
+ end
51
+
52
+ class DateTime #:nodoc
53
+ extend Mongoid::Extensions::TimeConversions
54
+ extend Mongoid::Extensions::DateTime::Conversions
55
+ end
56
+
57
+ class Date #:nodoc
58
+ extend Mongoid::Extensions::TimeConversions
59
+ extend Mongoid::Extensions::Date::Conversions
60
+ end
61
+
62
+ class Float #:nodoc
63
+ extend Mongoid::Extensions::Float::Conversions
64
+ end
65
+
66
+ class Hash #:nodoc
67
+ include Mongoid::Extensions::Hash::Accessors
68
+ include Mongoid::Extensions::Hash::Assimilation
69
+ include Mongoid::Extensions::Hash::CriteriaHelpers
70
+ include Mongoid::Extensions::Hash::Scoping
71
+ include Mongoid::Extensions::Hash::Conversions
72
+ end
73
+
74
+ class Integer #:nodoc
75
+ extend Mongoid::Extensions::Integer::Conversions
76
+ end
77
+
78
+ class NilClass #:nodoc
79
+ include Mongoid::Extensions::Nil::Assimilation
80
+ end
81
+
82
+ class Object #:nodoc:
83
+ include Mongoid::Extensions::Object::Conversions
84
+ end
85
+
86
+ class Proc #:nodoc:
87
+ include Mongoid::Extensions::Proc::Scoping
88
+ end
89
+
90
+ class String #:nodoc
91
+ include Mongoid::Extensions::String::Inflections
92
+ extend Mongoid::Extensions::String::Conversions
93
+ end
94
+
95
+ class Symbol #:nodoc
96
+ remove_method :size if instance_methods.include? :size # temporal fix for ruby 1.9
97
+ include Mongoid::Extensions::Symbol::Inflections
98
+ end
99
+
100
+ class Time #:nodoc
101
+ extend Mongoid::Extensions::TimeConversions
102
+ end
103
+
104
+ class BSON::ObjectID #:nodoc
105
+ extend Mongoid::Extensions::ObjectID::Conversions
106
+ end