Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent overwriting
Hash#except
method present in Ruby 3+
Ruby 3+ introduced `Hash#except` method natively [1], so we can skip I18n's custom implementation here if the method is already defined. This follows the same Rails convention [2]. Note: This seems to be causing a `stack level too deep (SystemStackError)` with a specific set of Gemfiles under Ruby 3, reported to `SimpleForm` originally [3]. I haven't been able to fully narrow it down after some initial investigation, nor reproduce it without the given set of gems in the Gemfile reported, but it seems there's some interactions between those gems, and combined with the fact that Ancestry loads I18n early on to setup the load path [4], is possibly causing calls to `Hash#except` to hang or raise with the `stack level too deep` error, and after skipping the method re-declaration here it's not reproducible anymore. [1] https://bugs.ruby-lang.org/issues/15822 [2] https://github.com/rails/rails/blob/5f3ff60084ab5d5921ca3499814e4697f8350ee7/activesupport/lib/active_support/core_ext/hash/except.rb#L12-L14 [3] heartcombo/simple_form#1724 steps to reproduce issue: heartcombo/simple_form#1724 (comment) [4] https://github.com/stefankroes/ancestry/blob/71fe7042791f5943b5370240e4c6068dce73233d/lib/ancestry.rb#L9-L10
- Loading branch information