What is the previous stable version of Mongoid with Ruby 3.0.0

Hi
As Mongoid latest version 7.2.1 has quite a few issues of saving , updating and also the validation errors. With Rails 6.1.3 and Ruby 3.0.0.
What is the previous stable version of mongoid other than 7.2.1 Which do not have any such issues as 7.2.1.
Source: https://jira.mongodb.org/browse/MONGOID-5048

Hi @hanish_jadala,

Ruby 3 is not currently supported by the MongoDB Ruby Driver or the Mongoid ODM, however is scheduled (see RUBY-2268) .

Until this work is done we recommend using a 2.x version of Ruby along with the latest driver and ODM compatible with your version of MongoDB.

1 Like

The main error that comes is through the translate method from the MongoidError class which i did a work around with a monkey patch

Mongoid::Errors::MongoidError.class_eval do
def translate(key, options)
::I18n.translate(“mongoid.#{key}”, **options)
end
end

As ruby 3 doesnt accept options directly as the arguments cannot be send as a hash we need to spread it to make it work.

@Manish_Sharma5,

FYI there is a PR at https://github.com/mongodb/mongoid/pull/4944 being discussed specifically for Mongoid and ::I18n.translate (tracked by MONGOID-5044).

1 Like