rubyconfig / config

Easiest way to add multi-environment yaml settings to Rails, Sinatra, Padrino and other Ruby projects.
Other
2.1k stars 230 forks source link

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

Closed ngoctien1102 closed 9 months ago

ngoctien1102 commented 1 year ago

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:inminimum': wrong number of arguments (given 0, expected 1) (ArgumentError)`

Ruby version: 3.1.3 Rails version: 7.0.4.2

How to reproduce:

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:inminimum': wrong number of arguments (given 0, expected 1) (ArgumentError)`

ikael21 commented 11 months ago

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

pkuczynski commented 11 months ago

Possibly this is related to https://github.com/rails/rails/issues/49457. We should have a fix soon...

ikael21 commented 11 months ago

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

Settings.length.to_h[:maximum]
rubywarlock commented 9 months ago

Patch in https://github.com/rubyconfig/config/pull/342 doesn't fix it for me.

pkuczynski commented 9 months ago

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

ikael21 commented 9 months ago

@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 commented 9 months ago

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

pkuczynski commented 9 months ago

Merged and published! Thank you @ikael21