Module: DHS::Record::Last::ClassMethods
- Defined in:
- lib/dhs/concerns/record/last.rb
Instance Method Summary collapse
Instance Method Details
#last(options = nil) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/dhs/concerns/record/last.rb', line 11 def last( = nil) = trace!() first_batch = find_by({}, ).parent if first_batch.paginated? pagination = first_batch._pagination find_by({ pagination_key => pagination.class.page_to_offset(pagination.last_page, pagination.limit) }, ) else first_batch.last end end |
#last!(options = nil) ⇒ Object
22 23 24 |
# File 'lib/dhs/concerns/record/last.rb', line 22 def last!( = nil) find_by!({}, trace!()) end |