public
Description: StrokeDB is an embeddable distributed document database written in Ruby
Homepage: http://strokedb.com/
Clone URL: git://github.com/yrashk/strokedb.git
Meta#first now accepts no arguments, same as Meta#find.
thewordnerd (author)
Wed Apr 23 14:47:55 -0700 2008
commit  9e8d771fb6aee81dbd9f170326e5004f309e0136
tree    aa65424c00fad6f6a4ac9dd68c1e19c69949c7ac
parent  4c26b5cd1129e676974d060751085c022a818954
...
193
194
195
196
 
197
198
199
...
193
194
195
 
196
197
198
199
0
@@ -193,7 +193,7 @@ module StrokeDB
0
     #
0
     # Finds the first document matching the given criteria.
0
     #
0
- def first(args)
0
+ def first(args = {})
0
       result = find(args)
0
       result.respond_to?(:first) ? result.first : result
0
     end
...
78
79
80
 
 
 
 
 
 
81
82
83
...
78
79
80
81
82
83
84
85
86
87
88
89
0
@@ -78,6 +78,12 @@ describe "Meta module", :shared => true do
0
     SomeName.first(:slot1 => 1).should == a
0
   end
0
   
0
+ it "should return first document if no args are passed to #first" do
0
+ a = SomeName.create!(:slot1 => 1)
0
+ b = SomeName.create!(:slot1 => 2)
0
+ SomeName.first.should == SomeName.find.first
0
+ end
0
+
0
   it "correctly handles finding via UUID on call to Meta#first" do
0
     a = SomeName.create!(:slot1 => 5)
0
     SomeName.first(a.uuid).should == a

Comments

    No one has commented yet.