aliasing field names in validators

suppose i have a model:

class Foo   belongs_to :some_customized_bar   validates_presence_of :some_customized_bar_id end

if i use 'error_messages_for :foo' in a view, i'll get errors like:   "Some customized bar can't be blank"

is it possible to tell the validator to use another name for that field, or do i have to do it myself using the model.errors collection?

thanks, jeff

validates_presence_of :some_customized_bar_id, :message => "RubyonRails is Awesome"

Jamal -- I'm not sure this answered Jeff's question, which involved setting another name for the *field*, I believe. Adding the :message parameter only affects what's after the field name, so when a form is validated, the <%= error_messages_for 'widget' %> results in text like

"Some customized bar RubyonRails is Awesome"

Is there a way to also change the field name (or not have it show up at all?)

Thanks Jamal, and thanks Jeff for asking the question :slight_smile:

Tom