You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading to stripe-rails 2.2.0 (or 2.2.1), I am getting this error when running rails c or rails s
…
8: from /Users/renchap/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/stripe-rails-2.2.0/lib/stripe/prices.rb:1:in `<main>'
7: from /Users/renchap/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/stripe-rails-2.2.0/lib/stripe/prices.rb:2:in `<module:Stripe>'
6: from /Users/renchap/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/stripe-rails-2.2.0/lib/stripe/prices.rb:6:in `<module:Prices>'
5: from /Users/renchap/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/stripe-rails-2.2.0/lib/stripe/configuration_builder.rb:14:in `configuration_for'
4: from /Users/renchap/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/stripe-rails-2.2.0/lib/stripe/configuration_builder.rb:14:in `class_eval'
3: from /Users/renchap/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/stripe-rails-2.2.0/lib/stripe/prices.rb:34:in `block in <module:Prices>'
2: from /Users/renchap/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/conversions.rb:70:in `to_sentence'
1: from /Users/renchap/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/i18n-1.8.6/lib/i18n.rb:198:in `translate'
/Users/renchap/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/i18n-1.8.6/lib/i18n.rb:342:in `enforce_available_locales!': :en is not a valid locale (I18n::InvalidLocale)
I am not sure what is happening here as my locales are defined as config.i18n.available_locales = %i[en fr]
The text was updated successfully, but these errors were encountered:
I also added config.i18n.available_locales = %i[en fr] to application.rb just to be sure. But I can't seem to recreate the error. Can you think of anything else I'm missing?
I managed to reproduce it: it depends on the location of the stripe-rails gem in your Gemfile!
For me it was near the end and the error occurred, but if I move it at the top of my Gemfile is works fine.
I added some debugging to I18n and with stripe-rails loaded first, I can see that it is called once with the default config (empty) and then with my own config:
With the gem loaded later, available_locales is empty:
:en
#<Set: {}>
[]
I guess stripe-i18n should only load locale-dependent code once the app has been initialized by Rails, not when the gem is loaded, so it is no-longer order dependent and will use the correct I18n config.
After upgrading to
stripe-rails
2.2.0 (or 2.2.1), I am getting this error when runningrails c
orrails s
I am not sure what is happening here as my locales are defined as
config.i18n.available_locales = %i[en fr]
The text was updated successfully, but these errors were encountered: