We Recommend

The Rails Way The Rails Way
Now, for the first time, there’s a comprehensive, authoritative guide to building production-quality software with Rails. Pioneering Rails developer Obie Fernandez and a team of experts illuminate the entire Rails API, along with the Ruby idioms, design approaches, libraries, and plug-ins that make Rails so valuable.


Posted By

brettarogers on 12/11/07


Tagged

textmate rails attributes model activerecord


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

smurf


Humanized Attributes


Published in: Rails 


  1. class User < ActiveRecord::Base
  2. HUMANIZED_ATTRIBUTES = {
  3. :email => "E-mail address"
  4. }
  5.  
  6. def self.human_attribute_name(attr)
  7. HUMANIZED_ATTRIBUTES[attr.to_sym] || super
  8. end
  9.  
  10. end

Report this snippet 

You need to login to post a comment.