mongo_odm 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.rdoc +22 -8
- data/lib/mongo_odm/document/persistence.rb +12 -0
- data/lib/mongo_odm/version.rb +1 -1
- metadata +1 -1
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -384,6 +384,7 @@ All the validation methods defined in ActiveModel::Validations are included
|
|
384
384
|
Example:
|
385
385
|
|
386
386
|
class User
|
387
|
+
include MongoODM::Document
|
387
388
|
field :email
|
388
389
|
|
389
390
|
validates_presence_of :email
|
@@ -398,6 +399,7 @@ All the dirty object methods defined in ActiveModel::Dirty are included
|
|
398
399
|
Example:
|
399
400
|
|
400
401
|
class User
|
402
|
+
include MongoODM::Document
|
401
403
|
field :email
|
402
404
|
end
|
403
405
|
|
@@ -407,14 +409,26 @@ Example:
|
|
407
409
|
user.email_change # Returns [nil, "hello@h1labs.com"]
|
408
410
|
user.changes # Returns {"email" => [nil, "hello@h1labs.com"]}
|
409
411
|
|
412
|
+
= Others
|
413
|
+
|
414
|
+
Access to a cursor to the whole collection:
|
415
|
+
|
416
|
+
User.cursor
|
417
|
+
|
418
|
+
Use cursor methods directly on the class:
|
419
|
+
|
420
|
+
User.has_next?
|
421
|
+
User.each{...}
|
422
|
+
User.next_document
|
423
|
+
User.rewind!
|
424
|
+
...
|
425
|
+
|
410
426
|
= TODO
|
411
427
|
|
412
|
-
* Support join of different concatenated find calls to a single criteria object
|
413
|
-
* Add helpers to define attributes as referenced objects
|
414
428
|
* Allow to specify different database connections with each document definition
|
415
429
|
* Increase rspec coverage
|
416
430
|
* Document, document, document!
|
417
|
-
* Create useful modules to make common operations easier (versioning,
|
431
|
+
* Create useful modules to make common operations easier (versioning, trees, etc)
|
418
432
|
|
419
433
|
= More
|
420
434
|
|
@@ -422,12 +436,12 @@ For now, take a look at the Mongo Ruby driver syntax:
|
|
422
436
|
|
423
437
|
http://api.mongodb.org/ruby/1.0.8/index.html
|
424
438
|
|
425
|
-
=
|
439
|
+
= Credits
|
426
440
|
|
427
|
-
|
441
|
+
Carlos Paramio, http://h1labs.com.
|
428
442
|
|
429
|
-
|
443
|
+
See CONTRIBUTORS file for a list of contributions.
|
430
444
|
|
431
|
-
|
445
|
+
= License
|
432
446
|
|
433
|
-
|
447
|
+
See LICENSE file for details.
|
@@ -98,6 +98,10 @@ module MongoODM
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
+
def cursor
|
102
|
+
@cursor ||= find.cursor
|
103
|
+
end
|
104
|
+
|
101
105
|
def destroy_all(*args)
|
102
106
|
documents = find(*args)
|
103
107
|
count = documents.count
|
@@ -110,6 +114,14 @@ module MongoODM
|
|
110
114
|
return value if value.class == self
|
111
115
|
new(value)
|
112
116
|
end
|
117
|
+
|
118
|
+
def method_missing(method_name, *args, &block)
|
119
|
+
if cursor.respond_to?(method_name)
|
120
|
+
cursor.send(method_name, *args, &block)
|
121
|
+
else
|
122
|
+
super
|
123
|
+
end
|
124
|
+
end
|
113
125
|
|
114
126
|
end
|
115
127
|
|
data/lib/mongo_odm/version.rb
CHANGED