Tuesday, September 20, 2011

change table column name in Rails validation message

class Vendor < ActiveRecord::Base
validate_uniqness_of :gid, :message => "should be uniq"
HUMANIZED_ATTRIBUTES = {
    :gid => "vendor"
  }

  def self.human_attribute_name(attr)
    HUMANIZED_ATTRIBUTES[attr.to_sym] || super
  end

end

No comments:

Post a Comment

Contact Me for any help regarding rails/nodejs/php/mysql

Name

Email *

Message *