Wednesday, October 13, 2010

[Rails] Re: errors.add, setting the whole message

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

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate