Skip to content

Fixing find_first - #3

Open
olance wants to merge 2 commits into
cequel:masterfrom
olance:fixes/find_first
Open

Fixing find_first#3
olance wants to merge 2 commits into
cequel:masterfrom
olance:fixes/find_first

Conversation

@olance

@olance olance commented Aug 26, 2014

Copy link
Copy Markdown

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.

olance added 2 commits August 26, 2014 17:52
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

igraves commented Dec 13, 2014

Copy link
Copy Markdown

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

ishuah commented Mar 16, 2016

Copy link
Copy Markdown

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