hello! i would like to translate the error messages in my models like this: class Person < ActiveRecord::Base validates_presence_of :name, :message => _(''Please insert a name'') end but i get undefined method `_'' for Person:Class why? can i change this behaviour? btw, it would also be nice if there was a ActiveRecord::Errors.full_messages() without the @base.class.human_attribute_name(attr), so i would be able to translate the whole message.
Hi, On Sat, 19 Nov 2005 17:04:46 +0100 Simon Santoro <Simon.Santoro-Syd3ARw+vPY@public.gmane.org> wrote:> hello! > i would like to translate the error messages in my models like this: > > class Person < ActiveRecord::Base > validates_presence_of :name, :message => _(''Please insert a name'') > end > > > but i get > undefined method `_'' for Person:Class > > why? can i change this behaviour?=include GetText::Rails #You can call this on another file once #such as config/environment.rb after requiring #"gettext/rails". class Article < ActiveRecord::Base textdomain("yourapp") validates_presence_of :description, :message => _(''Please insert a name'') end = -- .:% Masao Mutoh<mutoh-+e5RZkbjevhHfZP73Gtkiw@public.gmane.org>
Masao Mutoh wrote:> > => include GetText::Rails #You can call this on another file once > #such as config/environment.rb after requiring > #"gettext/rails". > class Article < ActiveRecord::Base > textdomain("yourapp") > validates_presence_of :description, :message => _(''Please insert a name'') > end > =>Thank you Masao! For the second time :) Thanks for being on the list, and thanks for making rgettext