Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add numeral finder methods #1719

Open
wants to merge 5 commits into
base: 11
Choose a base branch
from

Conversation

polecpiotr
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant