Module: LHS::Record::Last::ClassMethods
- Defined in:
- lib/lhs/concerns/record/last.rb
Instance Method Summary collapse
Instance Method Details
#last(options = nil) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/lhs/concerns/record/last.rb', line 9 def last( = nil) 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
19 20 21 |
# File 'lib/lhs/concerns/record/last.rb', line 19 def last!( = nil) find_by!({}, ) end |