On Mar 5, 7:29 am, Matthew <[email protected]> wrote: > Dear all, > > Just wondering if there's any likelihood of a patch along the > following lines being accepted: > > class Sequel::Model > alias :save_without_transaction! :save! > def save!(*columns) > db.transaction {save_without_transaction!(*columns)} > end > end > > If no objections it would be nice to add this directly to the save > methods on Sequel::Model. > > I've found that not having transactions around this has bitten me in > the arse a few times, and can't think of many cases where you wouldn't > want one around the calls to before_create, insert, after_create... > Particularly useful if you're doing any state-modifying operations in > these surrounding callbacks (eg using after_create to insert > associated rows...).
Well, not with the alias (this isn't Rails), but I'd be open to a patch that had save! use a database transaction. I recommend using database triggers instead of hooks to handle data integrity issues, but that's not always possible. Jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
