Script / migration generation throws error about I18n in Rails 2.2.2

I have this on line 56 in my environment .rb: I18n.load_path + = Dir [File.join (RAILS_ROOT, 'lib', 'locale', '*. {Rb, yml}')]

I can run the application just fine, but when I try to run: script / migrate

I am getting this error: environment.rb: 56: uninitialized constant I18n (NameError)

What gives?

+1


source to share


2 answers


By default active_support

(where the module is located I18n

) is not loaded in environment.rb

. The correct way to add directories to your i18n boot path is as follows environment.rb

:

config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')]

      



I think that alternatively you could add require 'active_support'

before the module reference I18n

in environment.rb

, but that doesn't seem like a good idea.

+1


source


Thank. The line I used was the copied / pasted bad code from the tutorial.

So using

config.i18n.load_path

      



instead

I18n.load_path

      

I got rid of the error.

0


source







All Articles