-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
default_fallbacks configuration option doesn't work (AR, Postgres) #81
Comments
Looks like I've got it wrong. diff --git a/app.rb b/app.rb
index 4ac479e..c569251 100644
--- a/app.rb
+++ b/app.rb
@@ -25,7 +25,7 @@ I18n.available_locales = %i[en ru]
Mobility.configure do |config|
config.default_backend = :jsonb
config.accessor_method = :translates
- config.default_fallbacks = { ru: :en, en: :ru }
+ config.default_options = { fallbacks: { ru: :en, en: :ru } }
end
ActiveRecord::Schema.define do This change makes the test pass. |
You're right, now that I look at it again it is rather misleading. I'll think about changing the naming for 0.3. |
p.s. if you have a suggestion for naming that would be more intuitive, please let me know 😄 |
I think one thing I can do is to emit a warning if you try to set |
How about PS. I think the real issue is not the naming, it's that the docs are a bit lacking and the interface is not consistent. First, you have Second, the setter and the getter has "incompatible" types in the sense that one would expect the setter to take PPS. Thanks for the gem. I am looking for an alternative to migrate from Globalize, and I like it so far. |
That can help, but I would make it an exception instead of a warning. |
You're right about the interface for the fallbacks instance. I need to think a bit about restructuring the The fallbacks instance setter/getter stuff was not really given a great deal of thought when I first put it in there. The TBH I doubt anybody is actually using anything other than |
I also was confused by this, as I also set Seeing as it seems like most people won't be changing default_fallbacks, and if they do, they should know what they're doing, I'd consider removing mention of it from the readme. More generally, I think an example of all the config options, and how you use them would be helpful. |
Making some improvements to the documentation for default fallbacks in #148. |
Setting
default_fallbacks
configuration option doesn't have any (visible) effect. Consider the following snippet:I expected that setting
default_fallbacks
will make all translated attributes to fallback to existing locales by default. Moreover, when I try to use bothdefault_fallbacks
and thefallbacks
option totranslates
, I get "default_fallbacks
: undefined methodcall
for {:ru=>:en, :en=>:ru}:Hash (NoMethodError)":So I assume that either
default_fallbacks
is broken or the documentation is unclear on how to properly use it.Context
The text was updated successfully, but these errors were encountered: