ActiveRecord validates... custom field name.

Posted by Dmitriy Likhten on Stack Overflow See other posts from Stack Overflow or by Dmitriy Likhten
Published on 2010-03-26T06:02:56Z Indexed on 2010/03/26 6:13 UTC
Read the original article Hit count: 133

Filed under:
|

I would like to fix up some error messages my site generates. Here is the problem:

class Brand < ActiveRecord::Base
    validates_presence_of :foo
    ...
end

My goal is to make a message "Ticket description is required" instead of "Foo is required" or may not be blank, or whatever.

The reason this is so important is because lets say previously the field was ticket_summary. That was great and the server was coded to use that, but now due to crazy-insane business analysts it has been determined that ticket_summary is a poor name, and should be ticket_description. Now I don't necessarily want to have my db be driven by the user requirements for field names, especially since they can change frequently without functionality changes.

Is there a mechanism for providing this already?

© Stack Overflow or respective owner

Related posts about activerecord

Related posts about ruby-on-rails