activegraph icon indicating copy to clipboard operation
activegraph copied to clipboard

Add numeral finder methods

Open polecpiotr opened this issue 3 months ago • 0 comments

Hello I've been using active graph for some time and one thing that bothered me from the start was the absence of finder methods like second or third. This PR aims to add them. I've taken inspiration from rails repository

This pull introduces/changes:

  • Adds second, third, fourth and fifth methods to query records 'from the start'
  • Adds second_to_last and third_to_last methods to query records 'from the end'
  • Adds optional argument limit to first and last methods to return more than one record

In find_nth, conditional is necessary. If we have only one branch and always use limit, in the case of limit = 1 it doesn't work. first(1) returns one record as an array, not a singular object.

polecpiotr avatar Mar 22 '24 09:03 polecpiotr