Override ActiveRecord attribute methods
Echoing Gareth’s comments… your code will not work as written. It should be rewritten this way: def name=(name) write_attribute(:name, name.capitalize) end def name read_attribute(:name).downcase # No test for nil? end