Reputation: 33
I saw on the Github documentation of Mobility that it is possible to set default fallbacks for Mobility. I'm trying to do it like this:
Mobility.configure do |config|
config.default_backend = :table
config.accessor_method = :translates
config.default_fallbacks = { fr: :en, de: :en, nl: :en, en: :nl, es: :en, cn: :en }
end
But when I start the Rails console it will give me a no method error:
`default_fallbacks': undefined method `call' for {:fr=>:en, :de=>:en, :nl=>:en, :en=>:nl, :es=>:en, :cn=>:en}:Hash (NoMethodError)
How can I make this work?
Upvotes: 1
Views: 797
Reputation: 27374
The documentation on this is not very good. To set default fallbacks, you should set the value for the fallbacks
key on the default_options
configuration option, like this:
Mobility.configure do |config|
# ...
config.default_options[:fallbacks] = { fr: :en, de: :en, nl: :en, en: :nl, es: :en, cn: :en }
end
The default_fallbacks
configuration is for if you want to use a different fallback instance instead of I18n::Locale::Fallbacks.new
.
Upvotes: 1