开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜