I am aware of the :message option. What I was hoping to do is be able to use many of the default messages and just change the attribute name displayed. For example, something like:
attr_display_name :msg "Message" On Sep 25, 3:31 pm, Greg Donald <gdon...@gmail.com> wrote: > On Fri, Sep 25, 2009 at 4:49 PM, drewB <dbats...@gmail.com> wrote: > > > Is there an easy way to customize the display name of the attributed > > used in a validation error message. For example, let's say I have an > > active record with the attribute :msg that is validated for presence. > > If is doesn't exist I don't want the user to see "msg can't be > > blank!" I want it to say "Message can't be blank!" Is there an easy > > way to do that? > > Have you read the validation documentation? > > All of the Rails validators support a :message option, for example > look at validates_presence_of: > > http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMeth... > > See where it says "message - A custom error message (default is: > "can‘t be blank")." ? That means when you write > > validates_presence_of :foo, :message => "Message can't be blank!" > > -- > Greg Donaldhttp://destiney.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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---