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

Fixing find_first #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fixing find_first #3

wants to merge 2 commits into from

Conversation

olance
Copy link

@olance olance commented Aug 26, 2014

Fixes #1 by checking whether scope is a Record and whether it really exists, to return the proper value.

Added two tests to support this change.

First test highlights that `find_first` fails when it is used to find a single record with a condition on the partition key.
Second test was missing: we should check that `find_first` returns `nil` when no record could be found, as documented.
Because of the way `scope` is built (using `#[]`), it could sometimes return a single `Record` instance instead of a `RecordSet`.
This change accounts for this to avoid exceptions when calling `#first` blindly on the returned value from `#construct_scope`.
@igraves
Copy link

igraves commented Dec 13, 2014

Is this issue still outstanding with the master branch of orm_adapter-cequel? Would be nice to merge this fix if the issue is still there.

@ishuah
Copy link

ishuah commented Mar 16, 2016

Any word on when this fix will be merged?

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.

find_first fails with "undefined method first"
3 participants