Is there a particular reason why you wouldn't use the hooks provided for this purpose?
You've got after_create
, after_save
, after_update
, before_create
, before_save
, before_update
- and a bunch of others. Wouldn't one of those be suitable?
In fact, given what you've said, it sounds like before_save
is what you want, as you can catch any errors that occur whilst saving the second model and prevent the first one from being saved (by returning false from the before_save
call).