Forum: Ruby on Rails column human names in validation errors

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.
D25ef9e51ce7c257a211f6b34a8646be?d=identicon&s=25 Viliks (Guest)
on 2006-03-07 10:25
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
2f62bd976630967049a829b6e96d07c4?d=identicon&s=25 unknown (Guest)
on 2006-03-07 10:39
(Received via mailing list)
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 method `b' for #<Rail
s::Initializer:0x38d5b10> (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:in
`silence_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:in
`process'
        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:in
`require'
        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:in
`require'
        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
This topic is locked and can not be replied to.