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

minimum, maximum keys are conflicted with active_support methods. #329

Closed
ngoctien1102 opened this issue Feb 8, 2023 · 8 comments · Fixed by #347
Closed

minimum, maximum keys are conflicted with active_support methods. #329

ngoctien1102 opened this issue Feb 8, 2023 · 8 comments · Fixed by #347
Labels
Milestone

Comments

@ngoctien1102
Copy link

When upgrading my project to new version of Ruby and Rails, the settings stored with minimum and maximum keys are now raising errors:
~/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/activesupport-7.0.4.2/lib/active_support/core_ext/enumerable.rb:44:in minimum': wrong number of arguments (given 0, expected 1) (ArgumentError)`

Ruby version: 3.1.3
Rails version: 7.0.4.2

How to reproduce:

  • Initialize new rails project
  • Add gem config, then run bundle
  • Edit config/settings.yml with:
    Screen Shot 2023-02-08 at 22 14 50
  • In rails console, try access the value with Settings.user_limit.minimum and Settings.user_limit.maximum

Expect: Should be able to access minimum and maximum with corresponding values of 9 and 99
Reality: Error raises ~/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/activesupport-7.0.4.2/lib/active_support/core_ext/enumerable.rb:44:in minimum': wrong number of arguments (given 0, expected 1) (ArgumentError)`

@ikael21
Copy link
Contributor

ikael21 commented Oct 3, 2023

Hi! I have the same issue after updating rails to 7 version. Is this issue fixed after all?

@pkuczynski
Copy link
Member

Possibly this is related to rails/rails#49457. We should have a fix soon...

@ikael21
Copy link
Contributor

ikael21 commented Oct 4, 2023

converting to hash working fine, but it's a temporary solution, waiting for the fix, thanks @pkuczynski

Settings.length.to_h[:maximum]

@rubywarlock
Copy link

Patch in #342
doesn't fix it for me.

@pkuczynski
Copy link
Member

I am not able to work on a fix, but I will happily approve a PR and make a quick release. Any volunteer?

@pkuczynski pkuczynski added the bug label Dec 15, 2023
@ikael21
Copy link
Contributor

ikael21 commented Dec 16, 2023

@pkuczynski hi! I'd like to contribute. First, I need to explore a little bit how the code works and then I can suggest my solution and we can discuss it here

@ikael21
Copy link
Contributor

ikael21 commented Dec 16, 2023

@pkuczynski pull request is ready for review, I decided to fix it right away as it turned out to be an easy one 😸

@pkuczynski pkuczynski added this to the 5.1.0 milestone Dec 18, 2023
@pkuczynski
Copy link
Member

Merged and published! Thank you @ikael21

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

Successfully merging a pull request may close this issue.

4 participants