Adding automatic column calculation

Hi,

I want to add a column that would get calculated automatically
whenever I update an object.
For example, a checksum, of other columns in the model.

It should run whenever I do save, save!, update_attributes, etc.

Where would be a logical place to add this in my model?

Thanks,
Helzer

before_save ?

Fred

class YourModel
  def before_save
    your callback code ...
  end
end

http://railsmanual.com/module/ActiveRecord::Callbacks

Thanks a lot Fred and alberto. I was just going to reinvent the wheel
here...

Helzer