Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-5119

Missing config client raises an error that is not related to the root cause

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: 7.3.0
    • 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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            maadamaceno@gmail.com Marco Damaceno
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: