Column human names in validation errors


#1

hi,
I don’t know how to change field names in error messages.
if I add error message like this:
errors.add( “age”, “You must be at least 18 years old” ) unless age >=
18

when error occures this text is displayed

Age You must be at least 18 years old

so the first word(s) is column human name for that attribute.
how can I change that? of course only in error message text.

thanx


#2

I don’t remember changing anything in my rails environment, but I have
now been getting following error anytime I attempt to use
script/generate tool in rails:

c:/Apache/Ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:155:in
load_environment': undefined local variable or methodb’ for # (NameError)
from
c:/Apache/Ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:155:in
load_environment' from c:/Apache/Ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/core_ext/kernel.rb:27:insilence_warnings’
from
c:/Apache/Ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:152:in
load_environment' from c:/Apache/Ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:81:inprocess’
from
c:/Apache/Ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:42:in
run' from ./script/../config/../config/environment.rb:10 from c:/Apache/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
from
c:/Apache/Ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:in
require' from c:/Apache/Ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/generate.rb:1 from c:/Apache/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
from
c:/Apache/Ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:in
`require’
from script/generate:3

Any suggestion? I cannot think of anything

Anu