mongo_thing 0.0.5 → 0.0.6
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.
- data/VERSION +1 -1
- data/lib/mongo_thing/document.rb +2 -1
- data/mongo_thing.gemspec +1 -1
- data/spec/integration/mongo_thing/document_spec.rb +5 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/lib/mongo_thing/document.rb
CHANGED
@@ -67,7 +67,8 @@ module MongoThing #:nodoc:
|
|
67
67
|
if spec_or_object_id.is_a? String
|
68
68
|
spec_or_object_id = BSON::ObjectId.from_string(spec_or_object_id)
|
69
69
|
end
|
70
|
-
|
70
|
+
mongo_doc = collection.find_one(spec_or_object_id, opts)
|
71
|
+
mongo_doc && self.new(mongo_doc)
|
71
72
|
end
|
72
73
|
|
73
74
|
# Creating
|
data/mongo_thing.gemspec
CHANGED
@@ -158,6 +158,11 @@ describe MongoThing::Document do
|
|
158
158
|
p.reload
|
159
159
|
p.name.should == "Tom"
|
160
160
|
end
|
161
|
+
|
162
|
+
it "should return nil if no document found with find_one" do
|
163
|
+
p = Person.create(:name => "Tom")
|
164
|
+
Person.find_one(:name => "Yorick").should be_nil
|
165
|
+
end
|
161
166
|
end
|
162
167
|
end
|
163
168
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo_thing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Higginbotham
|