Change the column name field in error message

Hi, When an error is display, it first show the column concerned. Does someone knows how to change the display column name?

Greg

Hi Greg,

Rails by default use DB column name while displaying errors on UI. You can choose one of the following options to write custom validation errors

  1. User  plugin  [http://rubyforge.org/projects/custom-err-msg/](http://rubyforge.org/projects/custom-err-msg/)
    
  2. Check validation errors in validate method and use add_to_base for custom messages
  3. Override error_messages_for method –Haribhau

Put this in the model:

HUMAN_ATTRIBUTES = {:some_column => 'Column display name', :some_other_column => 'Another column display name'} def self.human_attribute_name(attr)   HUMAN_ATTRIBUTES[attr.to_sym] || super end

Obviously you want to replace my examples (:some_column, 'Column display name', etc.) with your column names and display versions of those names.