Last Updated: July 03, 2016
·
2.872K
· nosolopau

Get rid of the Mongoid translation missing errors (Mongoid 4.0 & Rails 4.0)

If you are using Mongoid with an internationalised application, you will find that Mongoid tries to translate some errors. Since the major part of these errors are useful only for developers you may want to use english instead of translating them.

Picture
To fix this, you need to change your application.rb file, adding:

# Configure fallbacks for mongoid errors:
require "i18n/backend/fallbacks"
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
config.i18n.fallbacks = {'es' => 'en'}

Then you will need to restart your server. Now you should get:

Picture

:)

3 Responses
Add your response

That was really annoying.. Thank you!

over 1 year ago ·

WOW, thank you so much

over 1 year ago ·
config.i18n.fallbacks = { 'de' => 'en' } 

is enough in normal rails 4 applications

over 1 year ago ·