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

allow_nil: true on the find method does not work as expected. #1001

Closed
xxx opened this issue Nov 14, 2022 · 7 comments
Closed

allow_nil: true on the find method does not work as expected. #1001

xxx opened this issue Nov 14, 2022 · 7 comments

Comments

@xxx
Copy link

xxx commented Nov 14, 2022

Hi,

From the readme, I expect that I should be able to do something like MyModel.friendly.find('nonexistent-slug', allow_nil: true) and have the call return nil without raising an exception, but when I make this call, I instead get Couldn't find all MyModels with 'id': (nonexistent_slug, {:allow_nil=>true}) (found 0 results, but was looking for 2), as if the args are being splatted into a single array of IDs to find.

MyModel.friendly.find(id) without allow_nil works as expected.

I'm wondering if this is something to do with the change in how keyword args are handled between Ruby 2 and 3.

FriendlyId: 5.4.2
Ruby: 3.1.2p20
Rails: 7.0.4

@andrewcmyk
Copy link

@parndt
Copy link
Collaborator

parndt commented Nov 15, 2022

Apologies, this is not released yet.

@parndt
Copy link
Collaborator

parndt commented Nov 15, 2022

Version 5.5.0 pushed @xxx please can you try that version? 😄

@xxx
Copy link
Author

xxx commented Nov 17, 2022

@parndt 5.5.0 is working great. thanks!

@xxx xxx closed this as completed Nov 17, 2022
@dchacke
Copy link
Contributor

dchacke commented Jan 18, 2024

You may want to update the Readme accordingly and prompt users to install ~> 5.5.0.

@parndt
Copy link
Collaborator

parndt commented Jan 19, 2024

thanks @dchacke that's good advice 🚀 - do you happen to have any capacity to open a pull request that makes that change please? Or even if you are able to add it to #1023 ?

@dchacke
Copy link
Contributor

dchacke commented Jan 19, 2024

yea done

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

No branches or pull requests

4 participants