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

[BUG] I18n.exists?(nil) returns true #694

Open
jia-shopify opened this issue May 23, 2024 · 2 comments
Open

[BUG] I18n.exists?(nil) returns true #694

jia-shopify opened this issue May 23, 2024 · 2 comments

Comments

@jia-shopify
Copy link

What I tried to do

Using I18n.exists?(key) when the key is nil

What I expected to happen

Expect I18n.exists?(nil) to throw I18n::ArgumentError or return false

What actually happened

It returns true

Versions of i18n, rails, and anything else you think is necessary

The issue seems to come from this line.
Is there a specific reason why the line only checks if key is empty when it's string, instead of doing raise I18n::ArgumentError if !key.is_a?(String) || key.empty?

@KinWang-2013
Copy link
Contributor

@radar can I create a PR against this?

@radar
Copy link
Collaborator

radar commented Jul 19, 2024

Yes please :)

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

3 participants