Transaction with Model callback?


Is it possible to run a model callback under the scope of a transaction?
I would like to update a ‘Tags’ table every time a ‘Post’ is edited,
clearing and then creating some tags automatically (author, some
keywords, date etc).

I currently have a ‘after_save :update_tags’ callback in the post model,
but this is currently not running under a transaction.

Perhaps I am going about this in the wrong way?

Any help or insight is much appreciated.


On 11/26/06, Giant C. [email protected] wrote:

No? Read the api docs for ActiveRecord::Transactions::ClassMethods one
more time. Yup, the ActiveRecord::Callbacks page could use a note
about this as well.

If your callbacks really aren’t wrapped in a transaction, make sure
your “database” is using innodb tables, or better yet; switch to