Method: ActiveNode::FinderMethods#take
- Defined in:
- lib/active_node/graph/finder_methods.rb
#take(limit = nil) ⇒ Object
Gives a record (or N records if a parameter is supplied) without any implied order. The order will depend on the database implementation. If an order is supplied it will be respected.
Person.take # returns an object fetched by SELECT * FROM people LIMIT 1
Person.take(5) # returns 5 objects fetched by SELECT * FROM people LIMIT 5
Person.where(["name LIKE '%?'", name]).take
95 96 97 |
# File 'lib/active_node/graph/finder_methods.rb', line 95 def take(limit = nil) limit ? limit(limit).to_a : find_take end |