activegraph
activegraph copied to clipboard
Add numeral finder methods
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
andfifth
methods to query records 'from the start' - Adds
second_to_last
andthird_to_last
methods to query records 'from the end' - Adds optional argument
limit
tofirst
andlast
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.