I have the next error and I don't know how to resolve, I'm using rails 4.1 and ruby 2.1.3 the problem is with my locale file, I have app with portuguese language for default and I translate all the file necessaries, and in my local is right no problem but when do
heroku run rake db:migrate
I have the next error:
Running
rake db:migrateattached to terminal... up, run.5369 rake aborted! I18n::InvalidLocale: :es is not a valid locale /app/vendor/bundle/ruby/2.1.0/gems/i18n-0.7.0.beta1/lib/i18n.rb:284:inenforce_available_locales!' /app/vendor/bundle/ruby/2.1.0/gems/i18n-0.7.0.beta1/lib/i18n/config.rb:34:indefault_locale=' /app/vendor/bundle/ruby/2.1.0/gems/i18n-0.7.0.beta1/lib/i18n.rb:35:indefault_locale=' /app/config/environments/production.rb:75:inblock in '
I have a locale file and is :
I18n.load_path += Dir[Rails.root.join('lib', 'locales', '*.{rb,yml}')] I18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
I18n.available_locales = Dir[Rails.root.join('config', 'locales', '*.{yml}')].collect {|l| locale = l.scan(/.+/(..).yml/)[0]; locale[0].to_sym unless locale.nil?}.delete_if {|locale| locale.nil?}
I18n.default_locale = [:en, :es] I18n.config.enforce_available_locales = true
also in production.rb have :
I18n.default_locale = :es
I try all the options possibles but I don't have solution Thanks for the time !!
the solution for this problem is really easy and you need add in your application.rb this code:
Regards !