xpepermint
xpepermint

Reputation: 36243

Mongoid+Rails: Atomic callbacks?

I know that in Rails all ActiveRecord callbacks are executed inside transaction. So if something goes wrong nothing is changed/wrong. Will Mongoid gem handle this in the same way (no transactions available as far as I know)?

Thx!

Upvotes: 2

Views: 1876

Answers (1)

Frederick Cheung
Frederick Cheung

Reputation: 84114

There's no such thing as a transaction in mongodb, so no this won't be handled for you. Should something blow up in an after_save or something like that you'll need to fix the damage yourself.

The general approach (as the FAQ hints at) is to try and design around this by using mongo's atomic modifiers.

Upvotes: 2

Related Questions