Hi, When an error is display, it first show the column concerned. Does someone knows how to change the display column name?
Greg
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
User plugin [http://rubyforge.org/projects/custom-err-msg/](http://rubyforge.org/projects/custom-err-msg/)
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.