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.
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:
:)
Written by Pablo Torrecilla
Related protips
3 Responses
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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#