How to specify a callback in activerecord that is only called when the record is created or a certain field is updated?
I'm working on a small checkbook balancing webapp to teach myself rails. Account has a balance
field, which I would like to update when any of the the related Transaction.amount开发者_开发知识库
fields are changed/created. I'm looking through the docs, but I'm having a hard time visualizing how to do this.
You should employ an observer to do the job. Please checkout the docs.
精彩评论