Validation messages

Hi,

I’m developing a dutch ruby on rails application. So I want the error
messages to be in dutch. But when I add: ":message => ‘Geen wachtwoord
ingevuld’ " to the user model I get this error message:

" Password Geen wachtwoord ingevuld"

How can I remove the fieldname from the error message? So it would
say:

“Geen wachtwoord ingevuld”

you could probably do something like

validate_on_create :check_defaults
def check_defaults
errors.add("",“dutch text”) if self.password.length<5
end

On 19 Mar 2007, at 00:18, LeonB wrote:

I’m developing a dutch ruby on rails application. So I want the error
messages to be in dutch. But when I add: ":message => ‘Geen wachtwoord
ingevuld’ " to the user model I get this error message:

" Password Geen wachtwoord ingevuld"

How can I remove the fieldname from the error message? So it would
say:

“Geen wachtwoord ingevuld”

http://agilewebdevelopment.com/plugins/error_messages_for

Best regards

Peter De Berdt

Thanks! Works like a charm. Maybe a bit too much for what I want. But
maybe when I get to know Ruby/Rails better I’ll make one myself.

LeonB wrote:

Hi,

I’m developing a dutch ruby on rails application. So I want the error
messages to be in dutch. But when I add: ":message => ‘Geen wachtwoord
ingevuld’ " to the user model I get this error message:

" Password Geen wachtwoord ingevuld"

How can I remove the fieldname from the error message? So it would
say:

“Geen wachtwoord ingevuld”

Another solution for languages thing=>

You can change the return error message by editing the
default_error_messages array hash.

Example:
ActiveRecord::Errors.default_error_messages[:taken] = “is in use”

you put this line in your environment.rb file, and the error message
will be used across all your models validation uniqueness :smiley: