Forum: Ruby on Rails Migrations on models using gettext validation messages

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A4b45b0467e28925b5103b50f7d39e5d?d=identicon&s=25 Mark Beattie (Guest)
on 2006-04-03 08:13
(Received via mailing list)
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:in
`method_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 Beattie
Easy School Management
http://easyeikaiwa.com
A4b45b0467e28925b5103b50f7d39e5d?d=identicon&s=25 Mark (Guest)
on 2006-04-13 09:10
Hi,

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

cheers
This topic is locked and can not be replied to.