humanoid 1.2.7

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 (210) hide show
  1. data/.gitignore +6 -0
  2. data/.watchr +29 -0
  3. data/HISTORY +342 -0
  4. data/MIT_LICENSE +20 -0
  5. data/README.rdoc +56 -0
  6. data/Rakefile +53 -0
  7. data/VERSION +1 -0
  8. data/caliper.yml +4 -0
  9. data/humanoid.gemspec +374 -0
  10. data/lib/humanoid.rb +111 -0
  11. data/lib/humanoid/associations.rb +258 -0
  12. data/lib/humanoid/associations/belongs_to.rb +64 -0
  13. data/lib/humanoid/associations/belongs_to_related.rb +62 -0
  14. data/lib/humanoid/associations/has_many.rb +180 -0
  15. data/lib/humanoid/associations/has_many_related.rb +109 -0
  16. data/lib/humanoid/associations/has_one.rb +95 -0
  17. data/lib/humanoid/associations/has_one_related.rb +81 -0
  18. data/lib/humanoid/associations/options.rb +57 -0
  19. data/lib/humanoid/associations/proxy.rb +31 -0
  20. data/lib/humanoid/attributes.rb +184 -0
  21. data/lib/humanoid/callbacks.rb +23 -0
  22. data/lib/humanoid/collection.rb +118 -0
  23. data/lib/humanoid/collections/cyclic_iterator.rb +34 -0
  24. data/lib/humanoid/collections/master.rb +28 -0
  25. data/lib/humanoid/collections/mimic.rb +46 -0
  26. data/lib/humanoid/collections/operations.rb +41 -0
  27. data/lib/humanoid/collections/slaves.rb +44 -0
  28. data/lib/humanoid/commands.rb +182 -0
  29. data/lib/humanoid/commands/create.rb +21 -0
  30. data/lib/humanoid/commands/delete.rb +16 -0
  31. data/lib/humanoid/commands/delete_all.rb +23 -0
  32. data/lib/humanoid/commands/deletion.rb +18 -0
  33. data/lib/humanoid/commands/destroy.rb +19 -0
  34. data/lib/humanoid/commands/destroy_all.rb +23 -0
  35. data/lib/humanoid/commands/save.rb +27 -0
  36. data/lib/humanoid/components.rb +24 -0
  37. data/lib/humanoid/config.rb +84 -0
  38. data/lib/humanoid/contexts.rb +25 -0
  39. data/lib/humanoid/contexts/enumerable.rb +117 -0
  40. data/lib/humanoid/contexts/ids.rb +25 -0
  41. data/lib/humanoid/contexts/mongo.rb +224 -0
  42. data/lib/humanoid/contexts/paging.rb +42 -0
  43. data/lib/humanoid/criteria.rb +259 -0
  44. data/lib/humanoid/criterion/complex.rb +21 -0
  45. data/lib/humanoid/criterion/exclusion.rb +65 -0
  46. data/lib/humanoid/criterion/inclusion.rb +91 -0
  47. data/lib/humanoid/criterion/optional.rb +128 -0
  48. data/lib/humanoid/cursor.rb +82 -0
  49. data/lib/humanoid/document.rb +300 -0
  50. data/lib/humanoid/enslavement.rb +38 -0
  51. data/lib/humanoid/errors.rb +77 -0
  52. data/lib/humanoid/extensions.rb +84 -0
  53. data/lib/humanoid/extensions/array/accessors.rb +17 -0
  54. data/lib/humanoid/extensions/array/aliasing.rb +4 -0
  55. data/lib/humanoid/extensions/array/assimilation.rb +26 -0
  56. data/lib/humanoid/extensions/array/conversions.rb +29 -0
  57. data/lib/humanoid/extensions/array/parentization.rb +13 -0
  58. data/lib/humanoid/extensions/boolean/conversions.rb +16 -0
  59. data/lib/humanoid/extensions/date/conversions.rb +15 -0
  60. data/lib/humanoid/extensions/datetime/conversions.rb +17 -0
  61. data/lib/humanoid/extensions/float/conversions.rb +16 -0
  62. data/lib/humanoid/extensions/hash/accessors.rb +38 -0
  63. data/lib/humanoid/extensions/hash/assimilation.rb +30 -0
  64. data/lib/humanoid/extensions/hash/conversions.rb +15 -0
  65. data/lib/humanoid/extensions/hash/criteria_helpers.rb +20 -0
  66. data/lib/humanoid/extensions/hash/scoping.rb +12 -0
  67. data/lib/humanoid/extensions/integer/conversions.rb +16 -0
  68. data/lib/humanoid/extensions/nil/assimilation.rb +13 -0
  69. data/lib/humanoid/extensions/object/conversions.rb +33 -0
  70. data/lib/humanoid/extensions/proc/scoping.rb +12 -0
  71. data/lib/humanoid/extensions/string/conversions.rb +15 -0
  72. data/lib/humanoid/extensions/string/inflections.rb +97 -0
  73. data/lib/humanoid/extensions/symbol/inflections.rb +36 -0
  74. data/lib/humanoid/extensions/time/conversions.rb +18 -0
  75. data/lib/humanoid/factory.rb +19 -0
  76. data/lib/humanoid/field.rb +39 -0
  77. data/lib/humanoid/fields.rb +62 -0
  78. data/lib/humanoid/finders.rb +224 -0
  79. data/lib/humanoid/identity.rb +39 -0
  80. data/lib/humanoid/indexes.rb +30 -0
  81. data/lib/humanoid/matchers.rb +36 -0
  82. data/lib/humanoid/matchers/all.rb +11 -0
  83. data/lib/humanoid/matchers/default.rb +26 -0
  84. data/lib/humanoid/matchers/exists.rb +13 -0
  85. data/lib/humanoid/matchers/gt.rb +11 -0
  86. data/lib/humanoid/matchers/gte.rb +11 -0
  87. data/lib/humanoid/matchers/in.rb +11 -0
  88. data/lib/humanoid/matchers/lt.rb +11 -0
  89. data/lib/humanoid/matchers/lte.rb +11 -0
  90. data/lib/humanoid/matchers/ne.rb +11 -0
  91. data/lib/humanoid/matchers/nin.rb +11 -0
  92. data/lib/humanoid/matchers/size.rb +11 -0
  93. data/lib/humanoid/memoization.rb +27 -0
  94. data/lib/humanoid/named_scope.rb +40 -0
  95. data/lib/humanoid/scope.rb +75 -0
  96. data/lib/humanoid/timestamps.rb +30 -0
  97. data/lib/humanoid/versioning.rb +28 -0
  98. data/perf/benchmark.rb +77 -0
  99. data/spec/integration/humanoid/associations_spec.rb +301 -0
  100. data/spec/integration/humanoid/attributes_spec.rb +22 -0
  101. data/spec/integration/humanoid/commands_spec.rb +216 -0
  102. data/spec/integration/humanoid/contexts/enumerable_spec.rb +33 -0
  103. data/spec/integration/humanoid/criteria_spec.rb +224 -0
  104. data/spec/integration/humanoid/document_spec.rb +587 -0
  105. data/spec/integration/humanoid/extensions_spec.rb +26 -0
  106. data/spec/integration/humanoid/finders_spec.rb +119 -0
  107. data/spec/integration/humanoid/inheritance_spec.rb +137 -0
  108. data/spec/integration/humanoid/named_scope_spec.rb +46 -0
  109. data/spec/models/address.rb +39 -0
  110. data/spec/models/animal.rb +6 -0
  111. data/spec/models/comment.rb +8 -0
  112. data/spec/models/country_code.rb +6 -0
  113. data/spec/models/employer.rb +5 -0
  114. data/spec/models/game.rb +6 -0
  115. data/spec/models/inheritance.rb +56 -0
  116. data/spec/models/location.rb +5 -0
  117. data/spec/models/mixed_drink.rb +4 -0
  118. data/spec/models/name.rb +13 -0
  119. data/spec/models/namespacing.rb +11 -0
  120. data/spec/models/patient.rb +4 -0
  121. data/spec/models/person.rb +98 -0
  122. data/spec/models/pet.rb +7 -0
  123. data/spec/models/pet_owner.rb +6 -0
  124. data/spec/models/phone.rb +7 -0
  125. data/spec/models/post.rb +15 -0
  126. data/spec/models/translation.rb +5 -0
  127. data/spec/models/vet_visit.rb +5 -0
  128. data/spec/spec.opts +3 -0
  129. data/spec/spec_helper.rb +31 -0
  130. data/spec/unit/mongoid/associations/belongs_to_related_spec.rb +141 -0
  131. data/spec/unit/mongoid/associations/belongs_to_spec.rb +193 -0
  132. data/spec/unit/mongoid/associations/has_many_related_spec.rb +387 -0
  133. data/spec/unit/mongoid/associations/has_many_spec.rb +471 -0
  134. data/spec/unit/mongoid/associations/has_one_related_spec.rb +179 -0
  135. data/spec/unit/mongoid/associations/has_one_spec.rb +282 -0
  136. data/spec/unit/mongoid/associations/options_spec.rb +191 -0
  137. data/spec/unit/mongoid/associations_spec.rb +545 -0
  138. data/spec/unit/mongoid/attributes_spec.rb +484 -0
  139. data/spec/unit/mongoid/callbacks_spec.rb +55 -0
  140. data/spec/unit/mongoid/collection_spec.rb +171 -0
  141. data/spec/unit/mongoid/collections/cyclic_iterator_spec.rb +75 -0
  142. data/spec/unit/mongoid/collections/master_spec.rb +41 -0
  143. data/spec/unit/mongoid/collections/mimic_spec.rb +43 -0
  144. data/spec/unit/mongoid/collections/slaves_spec.rb +81 -0
  145. data/spec/unit/mongoid/commands/create_spec.rb +30 -0
  146. data/spec/unit/mongoid/commands/delete_all_spec.rb +58 -0
  147. data/spec/unit/mongoid/commands/delete_spec.rb +35 -0
  148. data/spec/unit/mongoid/commands/destroy_all_spec.rb +23 -0
  149. data/spec/unit/mongoid/commands/destroy_spec.rb +44 -0
  150. data/spec/unit/mongoid/commands/save_spec.rb +105 -0
  151. data/spec/unit/mongoid/commands_spec.rb +282 -0
  152. data/spec/unit/mongoid/config_spec.rb +165 -0
  153. data/spec/unit/mongoid/contexts/enumerable_spec.rb +374 -0
  154. data/spec/unit/mongoid/contexts/mongo_spec.rb +505 -0
  155. data/spec/unit/mongoid/contexts_spec.rb +25 -0
  156. data/spec/unit/mongoid/criteria_spec.rb +769 -0
  157. data/spec/unit/mongoid/criterion/complex_spec.rb +19 -0
  158. data/spec/unit/mongoid/criterion/exclusion_spec.rb +91 -0
  159. data/spec/unit/mongoid/criterion/inclusion_spec.rb +211 -0
  160. data/spec/unit/mongoid/criterion/optional_spec.rb +329 -0
  161. data/spec/unit/mongoid/cursor_spec.rb +74 -0
  162. data/spec/unit/mongoid/document_spec.rb +986 -0
  163. data/spec/unit/mongoid/enslavement_spec.rb +63 -0
  164. data/spec/unit/mongoid/errors_spec.rb +103 -0
  165. data/spec/unit/mongoid/extensions/array/accessors_spec.rb +50 -0
  166. data/spec/unit/mongoid/extensions/array/assimilation_spec.rb +24 -0
  167. data/spec/unit/mongoid/extensions/array/conversions_spec.rb +35 -0
  168. data/spec/unit/mongoid/extensions/array/parentization_spec.rb +20 -0
  169. data/spec/unit/mongoid/extensions/boolean/conversions_spec.rb +49 -0
  170. data/spec/unit/mongoid/extensions/date/conversions_spec.rb +102 -0
  171. data/spec/unit/mongoid/extensions/datetime/conversions_spec.rb +70 -0
  172. data/spec/unit/mongoid/extensions/float/conversions_spec.rb +61 -0
  173. data/spec/unit/mongoid/extensions/hash/accessors_spec.rb +184 -0
  174. data/spec/unit/mongoid/extensions/hash/assimilation_spec.rb +46 -0
  175. data/spec/unit/mongoid/extensions/hash/conversions_spec.rb +21 -0
  176. data/spec/unit/mongoid/extensions/hash/criteria_helpers_spec.rb +17 -0
  177. data/spec/unit/mongoid/extensions/hash/scoping_spec.rb +14 -0
  178. data/spec/unit/mongoid/extensions/integer/conversions_spec.rb +61 -0
  179. data/spec/unit/mongoid/extensions/nil/assimilation_spec.rb +24 -0
  180. data/spec/unit/mongoid/extensions/object/conversions_spec.rb +43 -0
  181. data/spec/unit/mongoid/extensions/proc/scoping_spec.rb +34 -0
  182. data/spec/unit/mongoid/extensions/string/conversions_spec.rb +17 -0
  183. data/spec/unit/mongoid/extensions/string/inflections_spec.rb +208 -0
  184. data/spec/unit/mongoid/extensions/symbol/inflections_spec.rb +91 -0
  185. data/spec/unit/mongoid/extensions/time/conversions_spec.rb +70 -0
  186. data/spec/unit/mongoid/factory_spec.rb +31 -0
  187. data/spec/unit/mongoid/field_spec.rb +81 -0
  188. data/spec/unit/mongoid/fields_spec.rb +158 -0
  189. data/spec/unit/mongoid/finders_spec.rb +368 -0
  190. data/spec/unit/mongoid/identity_spec.rb +88 -0
  191. data/spec/unit/mongoid/indexes_spec.rb +93 -0
  192. data/spec/unit/mongoid/matchers/all_spec.rb +27 -0
  193. data/spec/unit/mongoid/matchers/default_spec.rb +27 -0
  194. data/spec/unit/mongoid/matchers/exists_spec.rb +56 -0
  195. data/spec/unit/mongoid/matchers/gt_spec.rb +39 -0
  196. data/spec/unit/mongoid/matchers/gte_spec.rb +49 -0
  197. data/spec/unit/mongoid/matchers/in_spec.rb +27 -0
  198. data/spec/unit/mongoid/matchers/lt_spec.rb +39 -0
  199. data/spec/unit/mongoid/matchers/lte_spec.rb +49 -0
  200. data/spec/unit/mongoid/matchers/ne_spec.rb +27 -0
  201. data/spec/unit/mongoid/matchers/nin_spec.rb +27 -0
  202. data/spec/unit/mongoid/matchers/size_spec.rb +27 -0
  203. data/spec/unit/mongoid/matchers_spec.rb +329 -0
  204. data/spec/unit/mongoid/memoization_spec.rb +75 -0
  205. data/spec/unit/mongoid/named_scope_spec.rb +123 -0
  206. data/spec/unit/mongoid/scope_spec.rb +240 -0
  207. data/spec/unit/mongoid/timestamps_spec.rb +25 -0
  208. data/spec/unit/mongoid/versioning_spec.rb +41 -0
  209. data/spec/unit/mongoid_spec.rb +37 -0
  210. metadata +431 -0
@@ -0,0 +1,6 @@
1
+ .DS_STORE
2
+ coverage/*
3
+ pkg/*
4
+ scratch_directory/*
5
+ tmp/*
6
+ *.gem
data/.watchr ADDED
@@ -0,0 +1,29 @@
1
+ # Watchr is the preferred method to run specs automatically over rspactor for
2
+ # Mongoid. If you are using vim, you can add the file:
3
+ #
4
+ # ~/.vim/ftdetect/watchr.vim
5
+ #
6
+ # This should have only the following line in it:
7
+ #
8
+ # autocmd BufNewFile,BufRead *.watchr setf ruby
9
+ #
10
+ # This will enable vim to recognize this file as ruby code should you wish to
11
+ # edit it.
12
+ def run(cmd)
13
+ puts cmd
14
+ system cmd
15
+ end
16
+
17
+ def spec(file)
18
+ run "spec -O spec/spec.opts #{file}"
19
+ end
20
+
21
+ watch("spec/.*/*_spec\.rb") do |match|
22
+ p match[0]
23
+ spec(match[0])
24
+ end
25
+
26
+ watch('lib/(.*/.*)\.rb') do |match|
27
+ p match[1]
28
+ spec("spec/unit/#{match[1]}_spec.rb")
29
+ end
data/HISTORY ADDED
@@ -0,0 +1,342 @@
1
+ === 1.2.0
2
+ - Fixed composite key generation not to replace all
3
+ special chars with dashes.
4
+
5
+ - Memory optimizations, now wrapping the mongo cursor.
6
+
7
+ - Fixed memoization on has_many_related assocations.
8
+
9
+ - Fixed pagination on embedded associations
10
+
11
+ - Fixed after_update callback not getting fired.
12
+
13
+ - When a connection failure occurs, Humanoid tried to
14
+ retry the operation up to a configurable time.
15
+
16
+ - Humanoid now supports a configuration with a master
17
+ and multiple read slaves. It will direct all writes
18
+ to the master and all reads to the slaves. In the case
19
+ of a write, subsequent reads will be directed to the
20
+ master up to configurable number to try and counter
21
+ the 2 second slave sync delay.
22
+
23
+ - Fixed issue with criteria exclusion queries with ids.
24
+
25
+ - Humanoid only executes a count when explicitly paginating.
26
+
27
+ - Fixed Criteria offset to be a getter or setter
28
+
29
+ - Added indexes to foreign keys on belongs_to_related
30
+ associations.
31
+
32
+ - General code refactorings/cleanup
33
+
34
+ === 1.1.4
35
+ - Refactorings in preparation for next feature push.
36
+
37
+ - Associations may now have anonymous extensions.
38
+
39
+ - Ruby 1.9 compatibility updates. (brainopia)
40
+
41
+ - Document.to_json accepts options. (jsmestad)
42
+
43
+ === 1.1.3
44
+ - Nil can be passed into methods that set attributes.
45
+
46
+ - Humanoid.config can now take a block.
47
+
48
+ - Allow named_scopes and criteria class methods on
49
+ has_many_related if related is a Humanoid document.
50
+
51
+ - Document.find can now take an array of ids.
52
+
53
+ === 1.1.2
54
+ - Fixing issues with updates to parents.
55
+
56
+ === 1.1.1
57
+ - Document.create raises validations error, not no
58
+ method error on self.errors (Rick Frankel)
59
+
60
+ - Support default values that respond_to?(:call)
61
+ (procs/lambda) (ahoward)
62
+
63
+ - Added Humanoid.persist_in_safe_mode global config
64
+ option.
65
+
66
+ - Minor optimization: don't evaluate default procs
67
+ if it's not needed (brainopia)
68
+
69
+ === 1.1.0
70
+ - Nil attributes no longer persist nil values to the
71
+ database - the field will just not exist.
72
+
73
+ - create! and save! will now properly raise an error
74
+ when a database operation fails. This is handled
75
+ by using :safe => true as an option to
76
+ collection.save.
77
+
78
+ - Setting blank numbers casts to nil.
79
+
80
+ - Criteria and named scopes can now be used on has
81
+ many relationships. They can be chained with each
82
+ other off the association chain.
83
+
84
+ - Humanoid can now determine if a document matches a
85
+ mongodb selector without hitting the database via
86
+ Document#matches?(selector).
87
+
88
+ - Overall performance improvements in all areas.
89
+
90
+ - Ruby 1.9 compatibility fixes.
91
+
92
+ - Has many related now supports finding by id or
93
+ by an optional :all, :first, :last with a
94
+ conditions hash.
95
+
96
+ === 1.0.6
97
+
98
+ - Preventing the setting of empty values in attributes.
99
+
100
+ - Better inspect formatting
101
+
102
+ === 1.0.5
103
+
104
+ - Has one and has many associations now set the parent
105
+ object first before writing the attributes on
106
+ #build and #create.
107
+
108
+ === 1.0.4
109
+ - Modified criteria to use the querying class
110
+ when instantiating documents if there are no
111
+ subclasses.
112
+
113
+ - Floats that are empty strings or nil get
114
+ defaulted to 0.0
115
+
116
+ === 1.0.3
117
+ - Small performance improvements on finders
118
+
119
+ - Float.set allows setting of non-numeric string
120
+ in order for validates_numericality_of to fail
121
+ properly.
122
+
123
+ === 1.0.2
124
+ - Named scopes get added functionality:
125
+
126
+ - named scopes can now be criteria objects.
127
+
128
+ - named scoped can now be procs with criteria.
129
+
130
+ - named scopes and class methods that return
131
+ criteria can be chained with each other.
132
+
133
+ - When calling save on an embedded document whose
134
+ validation passes but the parent's validation
135
+ fails, it will properly return false.
136
+
137
+ === 1.0.1
138
+ - Documents now have named_scopes similar to
139
+ ActiveRecord named scopes. Please see rdoc or
140
+ specs for examples.
141
+
142
+ - Document#to_json properly works in all cases.
143
+
144
+ - ActiveSupport calls for inflections have been
145
+ moved into the String::Inflections module.
146
+
147
+ - Updated dependency on Validatable to 2.0.1
148
+
149
+ === 1.0.0
150
+ - Validations cleanup: Only before_validation and
151
+ after_validation callbacks are supported now.
152
+
153
+ - Dynamic fields have reader and writer methods
154
+ again, but only for instances where the dynamic
155
+ attribute exists.
156
+
157
+ - Lots of refactoring, mostly coverting common
158
+ fucntionality into modules for the upcoming rails
159
+ 2 and 3 gem split.
160
+
161
+ === 0.12.0
162
+ - Has one now works as expected:
163
+
164
+ - Has one associations will return nil, instead
165
+ of the proxy if the association has not been
166
+ set.
167
+
168
+ - Building/creating a has one is no longer handled
169
+ by calling the Document#association#build() or create(),
170
+ this is now handled by Document#build_name and
171
+ Document#create_name where "name" is the name
172
+ of the has one association.
173
+
174
+ - Passing a _type attribute to the #build_name
175
+ and #create_name methods will build/create
176
+ objects of that type, useful for creating
177
+ specific subclasses.
178
+
179
+ - The existing #build and #create methods will be
180
+ removed in the next release.
181
+
182
+ - Removed all dynamic finders. If you need to have
183
+ functionality similar to "find_or_(create|initialize)_by"
184
+ you can use the 2 new finders:
185
+
186
+ - Document.find_or_create_by(attributes): Will
187
+ look for a document in the database with the
188
+ supplied attributes, if found it will return the
189
+ document otherwise will create a new one with
190
+ the supplied attributes.
191
+
192
+ - Document.find_or_initialize_by(attributes): Will
193
+ look for a document in the database with the
194
+ supplied attributes, if found it will return the
195
+ document otherwise will instantiate a new one with
196
+ the supplied attributes.
197
+
198
+ - Fixed issue with empty hashes and arrays not getting
199
+ set on document instantiation.
200
+
201
+ === 0.11.9
202
+ - Fixed issue with non-us time zones and formats
203
+ parsing incorrectly.
204
+
205
+ - Fixed error when specifying field restrictions
206
+ in criteria and not providing the _type. It
207
+ will now automaticall get added if it is not
208
+ present.
209
+
210
+ - Slight cleanup of delegated methods in Document.
211
+
212
+ - Dynamic attributes no longer create setters and
213
+ getters on the class. They can be accessed from
214
+ the attributes hash directly. If they are used
215
+ frequently it is preferrable to just add a field
216
+ to the class manually.
217
+
218
+ - Criteria#min no longer always returns 0.0.
219
+
220
+ === 0.11.8
221
+ - Added #min and #max to criteria which takes a
222
+ single field argument.
223
+
224
+ === 0.11.7
225
+ - Added #sum to criteria which takes a single field
226
+ to aggregate on. Example: Person.sum(:age) would
227
+ return a float that was the sum of all people's
228
+ ages in the db.
229
+
230
+ - Fixed issue with queries from parent classes always
231
+ casting the returned documents to the parent.
232
+
233
+ - Fixed singleton require issue.
234
+
235
+ - Group queries now run as db commands
236
+
237
+ === 0.11.6
238
+ - Allow namespaced documents to default with:
239
+ "namespace_modelname"
240
+
241
+ - Fixed indexing of _type field to only happen on root
242
+ classes.
243
+
244
+ - Fixed creation of empty collections for embedded documents.
245
+
246
+ - Document.store_in now properly resets the collection
247
+ if the collection had already been accessed.
248
+
249
+ - Document.find(nil) now raises
250
+ Humanoid::Errors::InvalidOptions
251
+
252
+ === 0.11.5
253
+ - Removed dependency on mongo_ext, since latest version
254
+ was breaking on various operating systems.
255
+ === 0.11.4
256
+ - Fixed issue with dynamic fields: checking whether
257
+ the document responded to the attribute's method
258
+ should have checked the setter and not the getter
259
+
260
+ - Fixed has_one associations not being able to be
261
+ set to nil.
262
+
263
+ === 0.11.3
264
+ - Fixed issue with Document#save! not calling before
265
+ and after create callbacks if document is new
266
+
267
+ === 0.11.2
268
+ - Fixing bug where has many and has one relational
269
+ associations create method did not return the
270
+ associated document
271
+
272
+ === 0.11.1
273
+ - Querying for classes that have subclasses will also
274
+ return the subclasses as well, similar to
275
+ ActiveRecord.
276
+
277
+ - Adding configuration option allow_dynamic_fields. This
278
+ defaults to true and if set to false will raise an
279
+ error when trying to set an attribute on an object
280
+ that does not have a corresponding field defined.
281
+
282
+ === 0.11.0
283
+ - Set the collection name to store a document in via:
284
+ Document.store_in :collection_name
285
+
286
+ - Initial inheritance support:
287
+
288
+ - Documents and their associations can now have an
289
+ infinite number of subclasses.
290
+
291
+ - Has many and has one associations can build or
292
+ create specific subclasses by providing an optional
293
+ class as the last parameter to the #create and
294
+ #build methods on the respective associations.
295
+
296
+ - Querying for specific subclasses will only return
297
+ those documents which were saved as that subclass,
298
+ even though the hierarchy is stored in the same
299
+ collection.
300
+
301
+ - Deletion of subclass documents will only delete
302
+ documents of that type, even though they all exist
303
+ in the same collection. #delete_all and #destroy_all
304
+ also support this behavoir.
305
+
306
+ - Updated mongo and mongo_ext dependencies to 0.18.2
307
+
308
+ - Fixed save on new documents to return true instead
309
+ of the document itself.
310
+
311
+ === 0.10.6
312
+ - Fixed bug when trying to set empty strings on number
313
+ fields. (TypeError: can't convert Fixnum into String)
314
+
315
+ - Document.delete_all now drops the collection if
316
+ conditions are empty or nil.
317
+
318
+ === 0.10.5
319
+
320
+ - Documents that are embedded not properly respond to
321
+ Document#destroy and Document#delete.
322
+
323
+ - Documents can now be saved sans validation with
324
+ Document#save(false)
325
+
326
+ === 0.10.4
327
+
328
+ - Documents no longer inherit from Humanoid::Document.
329
+ Please include Humanoid::Document in all your models now.
330
+
331
+ - Config module added, you can now set one option:
332
+ Humanoid.raise_not_found_error = (true|false)
333
+
334
+ - When set to false, a Humanoid::Errors::DocumentNotFound
335
+ will NOT get thrown when performing a Document.find(id)
336
+ that does not return a document from the database.
337
+ This defaults to true.
338
+
339
+ - Humanoid::Document.collection_name macro added. You can
340
+ now set the name of the database collection to persist to.
341
+
342
+ - Humanoid::Criteria#select becomes Humanoid::Criteria#only
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Durran Jordan
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,56 @@
1
+ = Overview
2
+
3
+ == About Humanoid
4
+
5
+ A mirror of Mongoid (an awesome Ruby ODM framework for MongoDB) with a name I can say out loud. Everything other than the name is identical to the original releases.
6
+
7
+ == Project Tracking
8
+
9
+ * {Humanoid on Pivotal Tracker}[http://www.pivotaltracker.com/projects/27482]
10
+ * {Humanoid Google Group}[http://groups.google.com/group/humanoid]
11
+ * {Humanoid on CI Joe}[http://mongoid.org:4444/]
12
+ * {Humanoid Website and Documentation}[http://mongoid.org]
13
+
14
+ == Compatibility
15
+
16
+ Humanoid is developed against Ruby 1.8.6, 1.8.7, 1.9.1, 1.9.2
17
+
18
+ Note API changes will be frequent until 1.0, releases will be
19
+ frequent, and backwards compatibility will not be supported. Do not
20
+ expect the gem to be of full production quality until that
21
+ point. However, once 1.0 is released I will be providing backwards
22
+ compatibility through each minor version upgrade, as well as detailed
23
+ release notes and documentation with each release.
24
+
25
+ = Documentation
26
+
27
+ Please see the new Humanoid website for up-to-date documentation:
28
+ {mongoid.org}[http://mongoid.org]
29
+
30
+ = License
31
+
32
+ Copyright (c) 2009 Durran Jordan
33
+
34
+ Permission is hereby granted, free of charge, to any person obtaining
35
+ a copy of this software and associated documentation files (the
36
+ "Software"), to deal in the Software without restriction, including
37
+ without limitation the rights to use, copy, modify, merge, publish,
38
+ distribute, sublicense, and/or sell copies of the Software, and to
39
+ permit persons to whom the Software is furnished to do so, subject to
40
+ the following conditions:
41
+
42
+ The above copyright notice and this permission notice shall be
43
+ included in all copies or substantial portions of the Software.
44
+
45
+
46
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
47
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
48
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
49
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
50
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
51
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
52
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
53
+
54
+ = Credits
55
+
56
+ Durran Jordan: durran at gmail dot com