0

say I have

class MyClass
  include DataMapper::Resource
  property :id, Serial
  property :my_property, Text
end

How can I make a call to return a maximum of 3 items
Such as

MyClass.all(:my_property => "some_text", :max => 3)

Where the :max => n would indicate return n items.

I'm pretty sure there exists a built in function for this but I can't find it. Thanks.

Lev Dubinets
  • 788
  • 10
  • 32

1 Answers1

2

Use :limit

MyClass.all(:my_property => "some_text", :limit => 3)
Rob Davis
  • 15,597
  • 5
  • 45
  • 49