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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Unknown
    • Resolution: Duplicate
    • 7.3.0
    • None
    • None
    • Ruby 3.0.1

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: