Migrations on models using gettext validation messages


#1

Hi,

The time has come for me to explore migrations, and the first thing I’ve
found
is that it seems to be unaware of calls to the gettext function _() for
translating validation messages:

** Invoke migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute migrate
rake aborted!
undefined method _' for Account:Class /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:991:inmethod_missing’
/var/www/rails/easyeikaiwa/trunk/easyeikaiwa/config/…/app/models/account.rb:22

account.rb:22
validates_length_of :name, :within => 4…40, :message => _(“name was
too
short/long”)

Any ideas?

Mark B.
Easy School Management
http://easyeikaiwa.com


#2

Hi,

Thanks to the guys on #rubyonrails - turns out I just had to require
gettext in environment.rb instead of application.rb.

cheers