Module: ActiveRecord::Transactions
- Defined in:
- lib/card/active_record_ext.rb
Instance Method Summary collapse
-
#with_transaction_returning_status ⇒ Object
FIXME!! the following code is already in Rails 4 (see github.com/rails/rails/commit/c8792c7b2ea4f5fe7a5610225433ea8dd8d0f83e) it allows manual rollbacks in after_save (eg store events) to reset the object correctly hopefully we can soon get rid of this code!.
Instance Method Details
#with_transaction_returning_status ⇒ Object
FIXME!! the following code is already in Rails 4 (see github.com/rails/rails/commit/c8792c7b2ea4f5fe7a5610225433ea8dd8d0f83e) it allows manual rollbacks in after_save (eg store events) to reset the object correctly
hopefully we can soon get rid of this code!
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/card/active_record_ext.rb', line 59 def with_transaction_returning_status status = nil self.class.transaction do add_to_transaction begin status = yield rescue ActiveRecord::Rollback @_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) - 1 status = nil end raise ActiveRecord::Rollback unless status end status end |