It’s somehow trivial, but I found out about ‘write_attribute’ only just: (another case of rtfm)
class Thing < ActiveRecord::Base
def name=(str)
str.upcase! unless str.nil?
write_attribute(:name, str)
end
end
Update: Be careful if you use this with Datetime attributes.