Re: errors.add, setting the whole message

Max Williams
Wed, 13 Oct 2010 08:39:28 -0000

Sjoerd Andringa wrote in post #949766:
> It seems this feature has been added in 2.3.5
>
(http://github.com/rails/rails/blob/v2.3.5/activerecord/lib/active_record/validations.rb#L108).
> I''d recommend upgrading as Im not aware of an easy alternative way
of
> doing this.

Thanks Sjoerd, i might upgrade if needs be.  I''ve been looking in
./vendor/rails/activerecord/lib/active_record/locale/en.yml though and
it looks like i should be able to change the basic format for all error
messages:  it has this line

en:
  activerecord:
    errors:
      full_messages:
        format: "{{attribute}} {{message}}"

Which i thought would mean i could change it to

        format: "{{message}}"

which would globally remove the attribute name from the start of all
errors, which is fine as i can add it back in on an
attribute-by-attribute basis or stick with custom messages for
everything.

But, it doesn''t work.  I''ll keep hacking away...

cheers, max