-
Type: Bug
-
Resolution: Duplicate
-
Priority: Unknown
-
None
-
Affects Version/s: 7.3.0
-
Component/s: Associations, Persistence, Validations
-
None
-
Environment:Ruby 3.0.1
I18n.translate expects options as a keyword argument, but it receives a hash. It raises ArgumentError: wrong number of arguments (given 2, expected 0..1)
Location: translate method in lib/mongoid/errors/mongoid_error.rb:50
I18n documentation:
# This method uses keyword arguments.
# There is a breaking change in ruby that produces warning with ruby 2.7 and won't work as expected with ruby 3.0
# The "hash" parameter must be passed as keyword argument.
Locally, I fixed this issue as the following:
def translate(key, options)
::I18n.translate("#{BASE_KEY}.#{key}", **options)
end
I think the same error raises on other parts of the package.
- duplicates
-
MONGOID-4965 Ruby 3.0 Support
- Released