Change the column name field in error message

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


Hi Greg,

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

  1. User plugin
  2. Check validation errors in validate method and use add_to_base for
    custom messages
  3. Override error_messages_for method


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

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