humanoid 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.watchr +29 -0
- data/HISTORY +342 -0
- data/MIT_LICENSE +20 -0
- data/README.rdoc +56 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/caliper.yml +4 -0
- data/humanoid.gemspec +374 -0
- data/lib/humanoid.rb +111 -0
- data/lib/humanoid/associations.rb +258 -0
- data/lib/humanoid/associations/belongs_to.rb +64 -0
- data/lib/humanoid/associations/belongs_to_related.rb +62 -0
- data/lib/humanoid/associations/has_many.rb +180 -0
- data/lib/humanoid/associations/has_many_related.rb +109 -0
- data/lib/humanoid/associations/has_one.rb +95 -0
- data/lib/humanoid/associations/has_one_related.rb +81 -0
- data/lib/humanoid/associations/options.rb +57 -0
- data/lib/humanoid/associations/proxy.rb +31 -0
- data/lib/humanoid/attributes.rb +184 -0
- data/lib/humanoid/callbacks.rb +23 -0
- data/lib/humanoid/collection.rb +118 -0
- data/lib/humanoid/collections/cyclic_iterator.rb +34 -0
- data/lib/humanoid/collections/master.rb +28 -0
- data/lib/humanoid/collections/mimic.rb +46 -0
- data/lib/humanoid/collections/operations.rb +41 -0
- data/lib/humanoid/collections/slaves.rb +44 -0
- data/lib/humanoid/commands.rb +182 -0
- data/lib/humanoid/commands/create.rb +21 -0
- data/lib/humanoid/commands/delete.rb +16 -0
- data/lib/humanoid/commands/delete_all.rb +23 -0
- data/lib/humanoid/commands/deletion.rb +18 -0
- data/lib/humanoid/commands/destroy.rb +19 -0
- data/lib/humanoid/commands/destroy_all.rb +23 -0
- data/lib/humanoid/commands/save.rb +27 -0
- data/lib/humanoid/components.rb +24 -0
- data/lib/humanoid/config.rb +84 -0
- data/lib/humanoid/contexts.rb +25 -0
- data/lib/humanoid/contexts/enumerable.rb +117 -0
- data/lib/humanoid/contexts/ids.rb +25 -0
- data/lib/humanoid/contexts/mongo.rb +224 -0
- data/lib/humanoid/contexts/paging.rb +42 -0
- data/lib/humanoid/criteria.rb +259 -0
- data/lib/humanoid/criterion/complex.rb +21 -0
- data/lib/humanoid/criterion/exclusion.rb +65 -0
- data/lib/humanoid/criterion/inclusion.rb +91 -0
- data/lib/humanoid/criterion/optional.rb +128 -0
- data/lib/humanoid/cursor.rb +82 -0
- data/lib/humanoid/document.rb +300 -0
- data/lib/humanoid/enslavement.rb +38 -0
- data/lib/humanoid/errors.rb +77 -0
- data/lib/humanoid/extensions.rb +84 -0
- data/lib/humanoid/extensions/array/accessors.rb +17 -0
- data/lib/humanoid/extensions/array/aliasing.rb +4 -0
- data/lib/humanoid/extensions/array/assimilation.rb +26 -0
- data/lib/humanoid/extensions/array/conversions.rb +29 -0
- data/lib/humanoid/extensions/array/parentization.rb +13 -0
- data/lib/humanoid/extensions/boolean/conversions.rb +16 -0
- data/lib/humanoid/extensions/date/conversions.rb +15 -0
- data/lib/humanoid/extensions/datetime/conversions.rb +17 -0
- data/lib/humanoid/extensions/float/conversions.rb +16 -0
- data/lib/humanoid/extensions/hash/accessors.rb +38 -0
- data/lib/humanoid/extensions/hash/assimilation.rb +30 -0
- data/lib/humanoid/extensions/hash/conversions.rb +15 -0
- data/lib/humanoid/extensions/hash/criteria_helpers.rb +20 -0
- data/lib/humanoid/extensions/hash/scoping.rb +12 -0
- data/lib/humanoid/extensions/integer/conversions.rb +16 -0
- data/lib/humanoid/extensions/nil/assimilation.rb +13 -0
- data/lib/humanoid/extensions/object/conversions.rb +33 -0
- data/lib/humanoid/extensions/proc/scoping.rb +12 -0
- data/lib/humanoid/extensions/string/conversions.rb +15 -0
- data/lib/humanoid/extensions/string/inflections.rb +97 -0
- data/lib/humanoid/extensions/symbol/inflections.rb +36 -0
- data/lib/humanoid/extensions/time/conversions.rb +18 -0
- data/lib/humanoid/factory.rb +19 -0
- data/lib/humanoid/field.rb +39 -0
- data/lib/humanoid/fields.rb +62 -0
- data/lib/humanoid/finders.rb +224 -0
- data/lib/humanoid/identity.rb +39 -0
- data/lib/humanoid/indexes.rb +30 -0
- data/lib/humanoid/matchers.rb +36 -0
- data/lib/humanoid/matchers/all.rb +11 -0
- data/lib/humanoid/matchers/default.rb +26 -0
- data/lib/humanoid/matchers/exists.rb +13 -0
- data/lib/humanoid/matchers/gt.rb +11 -0
- data/lib/humanoid/matchers/gte.rb +11 -0
- data/lib/humanoid/matchers/in.rb +11 -0
- data/lib/humanoid/matchers/lt.rb +11 -0
- data/lib/humanoid/matchers/lte.rb +11 -0
- data/lib/humanoid/matchers/ne.rb +11 -0
- data/lib/humanoid/matchers/nin.rb +11 -0
- data/lib/humanoid/matchers/size.rb +11 -0
- data/lib/humanoid/memoization.rb +27 -0
- data/lib/humanoid/named_scope.rb +40 -0
- data/lib/humanoid/scope.rb +75 -0
- data/lib/humanoid/timestamps.rb +30 -0
- data/lib/humanoid/versioning.rb +28 -0
- data/perf/benchmark.rb +77 -0
- data/spec/integration/humanoid/associations_spec.rb +301 -0
- data/spec/integration/humanoid/attributes_spec.rb +22 -0
- data/spec/integration/humanoid/commands_spec.rb +216 -0
- data/spec/integration/humanoid/contexts/enumerable_spec.rb +33 -0
- data/spec/integration/humanoid/criteria_spec.rb +224 -0
- data/spec/integration/humanoid/document_spec.rb +587 -0
- data/spec/integration/humanoid/extensions_spec.rb +26 -0
- data/spec/integration/humanoid/finders_spec.rb +119 -0
- data/spec/integration/humanoid/inheritance_spec.rb +137 -0
- data/spec/integration/humanoid/named_scope_spec.rb +46 -0
- data/spec/models/address.rb +39 -0
- data/spec/models/animal.rb +6 -0
- data/spec/models/comment.rb +8 -0
- data/spec/models/country_code.rb +6 -0
- data/spec/models/employer.rb +5 -0
- data/spec/models/game.rb +6 -0
- data/spec/models/inheritance.rb +56 -0
- data/spec/models/location.rb +5 -0
- data/spec/models/mixed_drink.rb +4 -0
- data/spec/models/name.rb +13 -0
- data/spec/models/namespacing.rb +11 -0
- data/spec/models/patient.rb +4 -0
- data/spec/models/person.rb +98 -0
- data/spec/models/pet.rb +7 -0
- data/spec/models/pet_owner.rb +6 -0
- data/spec/models/phone.rb +7 -0
- data/spec/models/post.rb +15 -0
- data/spec/models/translation.rb +5 -0
- data/spec/models/vet_visit.rb +5 -0
- data/spec/spec.opts +3 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/unit/mongoid/associations/belongs_to_related_spec.rb +141 -0
- data/spec/unit/mongoid/associations/belongs_to_spec.rb +193 -0
- data/spec/unit/mongoid/associations/has_many_related_spec.rb +387 -0
- data/spec/unit/mongoid/associations/has_many_spec.rb +471 -0
- data/spec/unit/mongoid/associations/has_one_related_spec.rb +179 -0
- data/spec/unit/mongoid/associations/has_one_spec.rb +282 -0
- data/spec/unit/mongoid/associations/options_spec.rb +191 -0
- data/spec/unit/mongoid/associations_spec.rb +545 -0
- data/spec/unit/mongoid/attributes_spec.rb +484 -0
- data/spec/unit/mongoid/callbacks_spec.rb +55 -0
- data/spec/unit/mongoid/collection_spec.rb +171 -0
- data/spec/unit/mongoid/collections/cyclic_iterator_spec.rb +75 -0
- data/spec/unit/mongoid/collections/master_spec.rb +41 -0
- data/spec/unit/mongoid/collections/mimic_spec.rb +43 -0
- data/spec/unit/mongoid/collections/slaves_spec.rb +81 -0
- data/spec/unit/mongoid/commands/create_spec.rb +30 -0
- data/spec/unit/mongoid/commands/delete_all_spec.rb +58 -0
- data/spec/unit/mongoid/commands/delete_spec.rb +35 -0
- data/spec/unit/mongoid/commands/destroy_all_spec.rb +23 -0
- data/spec/unit/mongoid/commands/destroy_spec.rb +44 -0
- data/spec/unit/mongoid/commands/save_spec.rb +105 -0
- data/spec/unit/mongoid/commands_spec.rb +282 -0
- data/spec/unit/mongoid/config_spec.rb +165 -0
- data/spec/unit/mongoid/contexts/enumerable_spec.rb +374 -0
- data/spec/unit/mongoid/contexts/mongo_spec.rb +505 -0
- data/spec/unit/mongoid/contexts_spec.rb +25 -0
- data/spec/unit/mongoid/criteria_spec.rb +769 -0
- data/spec/unit/mongoid/criterion/complex_spec.rb +19 -0
- data/spec/unit/mongoid/criterion/exclusion_spec.rb +91 -0
- data/spec/unit/mongoid/criterion/inclusion_spec.rb +211 -0
- data/spec/unit/mongoid/criterion/optional_spec.rb +329 -0
- data/spec/unit/mongoid/cursor_spec.rb +74 -0
- data/spec/unit/mongoid/document_spec.rb +986 -0
- data/spec/unit/mongoid/enslavement_spec.rb +63 -0
- data/spec/unit/mongoid/errors_spec.rb +103 -0
- data/spec/unit/mongoid/extensions/array/accessors_spec.rb +50 -0
- data/spec/unit/mongoid/extensions/array/assimilation_spec.rb +24 -0
- data/spec/unit/mongoid/extensions/array/conversions_spec.rb +35 -0
- data/spec/unit/mongoid/extensions/array/parentization_spec.rb +20 -0
- data/spec/unit/mongoid/extensions/boolean/conversions_spec.rb +49 -0
- data/spec/unit/mongoid/extensions/date/conversions_spec.rb +102 -0
- data/spec/unit/mongoid/extensions/datetime/conversions_spec.rb +70 -0
- data/spec/unit/mongoid/extensions/float/conversions_spec.rb +61 -0
- data/spec/unit/mongoid/extensions/hash/accessors_spec.rb +184 -0
- data/spec/unit/mongoid/extensions/hash/assimilation_spec.rb +46 -0
- data/spec/unit/mongoid/extensions/hash/conversions_spec.rb +21 -0
- data/spec/unit/mongoid/extensions/hash/criteria_helpers_spec.rb +17 -0
- data/spec/unit/mongoid/extensions/hash/scoping_spec.rb +14 -0
- data/spec/unit/mongoid/extensions/integer/conversions_spec.rb +61 -0
- data/spec/unit/mongoid/extensions/nil/assimilation_spec.rb +24 -0
- data/spec/unit/mongoid/extensions/object/conversions_spec.rb +43 -0
- data/spec/unit/mongoid/extensions/proc/scoping_spec.rb +34 -0
- data/spec/unit/mongoid/extensions/string/conversions_spec.rb +17 -0
- data/spec/unit/mongoid/extensions/string/inflections_spec.rb +208 -0
- data/spec/unit/mongoid/extensions/symbol/inflections_spec.rb +91 -0
- data/spec/unit/mongoid/extensions/time/conversions_spec.rb +70 -0
- data/spec/unit/mongoid/factory_spec.rb +31 -0
- data/spec/unit/mongoid/field_spec.rb +81 -0
- data/spec/unit/mongoid/fields_spec.rb +158 -0
- data/spec/unit/mongoid/finders_spec.rb +368 -0
- data/spec/unit/mongoid/identity_spec.rb +88 -0
- data/spec/unit/mongoid/indexes_spec.rb +93 -0
- data/spec/unit/mongoid/matchers/all_spec.rb +27 -0
- data/spec/unit/mongoid/matchers/default_spec.rb +27 -0
- data/spec/unit/mongoid/matchers/exists_spec.rb +56 -0
- data/spec/unit/mongoid/matchers/gt_spec.rb +39 -0
- data/spec/unit/mongoid/matchers/gte_spec.rb +49 -0
- data/spec/unit/mongoid/matchers/in_spec.rb +27 -0
- data/spec/unit/mongoid/matchers/lt_spec.rb +39 -0
- data/spec/unit/mongoid/matchers/lte_spec.rb +49 -0
- data/spec/unit/mongoid/matchers/ne_spec.rb +27 -0
- data/spec/unit/mongoid/matchers/nin_spec.rb +27 -0
- data/spec/unit/mongoid/matchers/size_spec.rb +27 -0
- data/spec/unit/mongoid/matchers_spec.rb +329 -0
- data/spec/unit/mongoid/memoization_spec.rb +75 -0
- data/spec/unit/mongoid/named_scope_spec.rb +123 -0
- data/spec/unit/mongoid/scope_spec.rb +240 -0
- data/spec/unit/mongoid/timestamps_spec.rb +25 -0
- data/spec/unit/mongoid/versioning_spec.rb +41 -0
- data/spec/unit/mongoid_spec.rb +37 -0
- metadata +431 -0
data/.gitignore
ADDED
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
|
data/MIT_LICENSE
ADDED
@@ -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.
|
data/README.rdoc
ADDED
@@ -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
|