Method: DataMapper::Query#slice!
- Defined in:
- lib/dm-core/query.rb
#slice!(*args) ⇒ Object
Slices collection by adding limit and offset to the query, so a single query is executed
will execute query with the following limit (when repository uses DataObjects adapter, and thus queries use SQL):
LIMIT 10
and then takes a slice of collection in the Ruby space
588 589 590 591 592 593 594 595 596 |
# File 'lib/dm-core/query.rb', line 588 def slice!(*args) offset, limit = extract_slice_arguments(*args) if self.limit || self.offset > 0 offset, limit = get_relative_position(offset, limit) end update(:offset => offset, :limit => limit) end |