mongodb 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mongo/object/object.rb +10 -8
- data/readme.md +3 -1
- metadata +1 -1
data/lib/mongo/object/object.rb
CHANGED
@@ -7,13 +7,15 @@ module Mongo::Object
|
|
7
7
|
return false if opts[:callbacks] and !::Mongo::Object.run_before_callbacks(self, :validate)
|
8
8
|
|
9
9
|
child_opts = opts.merge internal: true
|
10
|
-
|
11
|
-
|
12
|
-
::Mongo::Object.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
result = [
|
11
|
+
child_objects.all?{|group| group.all?{|obj| obj.valid?(child_opts)}},
|
12
|
+
::Mongo::Object.run_validations(self),
|
13
|
+
errors.empty?
|
14
|
+
].all?
|
15
|
+
|
16
|
+
::Mongo::Object.run_after_callbacks(self, :validate) if opts[:callbacks]
|
17
|
+
|
18
|
+
result
|
17
19
|
ensure
|
18
20
|
clear_child_objects unless opts[:internal]
|
19
21
|
end
|
@@ -288,7 +290,7 @@ module Mongo::Object
|
|
288
290
|
raise_error "unknown callback method (#{method})!"
|
289
291
|
end
|
290
292
|
|
291
|
-
|
293
|
+
if type == :after
|
292
294
|
::Mongo::Object.run_after_callbacks self, method
|
293
295
|
else
|
294
296
|
true
|
data/readme.md
CHANGED
@@ -3,6 +3,7 @@ Ruby object persistence & driver enhancements for MongoDB.
|
|
3
3
|
1. Driver enchancements.
|
4
4
|
2. Migrations.
|
5
5
|
3. Persistence for any Ruby object.
|
6
|
+
4. Object Model [mongodb_model][mongodb_model]
|
6
7
|
|
7
8
|
Lower layers are independent from upper, use only what You need.
|
8
9
|
|
@@ -190,4 +191,5 @@ Copyright (c) Alexey Petrushin, http://petrush.in, released under the MIT licens
|
|
190
191
|
|
191
192
|
[mongo_mapper_ext]: https://github.com/alexeypetrushin/mongo_mapper_ext
|
192
193
|
[mongoid_misc]: https://github.com/alexeypetrushin/mongoid_misc
|
193
|
-
[code_stats]: https://github.com/alexeypetrushin/mongodb/raw/master/docs/code_stats.png
|
194
|
+
[code_stats]: https://github.com/alexeypetrushin/mongodb/raw/master/docs/code_stats.png
|
195
|
+
[mongodb_model]: https://github.com/alexeypetrushin/mongodb_model
|