Sha256: 208597922c8f4854f16cc96168f3647eced33a1cc613e44eedd122c7bb9b3a6e
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
module ActiveRecord::Turntable module ActiveRecordExt module Transactions def with_transaction_returning_status if self.class.turntable_enabled? status = nil if self.new_record? and self.turntable_shard_key.to_s == self.class.primary_key and self.id.nil? and self.class.connection.prefetch_primary_key?(self.class.table_name) self.id = self.class.connection.next_sequence_value(self.class.sequence_name) end self.class.connection.shards_transaction([self.turntable_shard]) 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 else super end end def add_to_transaction if self.class.turntable_enabled? if self.turntable_shard.connection.add_transaction_record(self) remember_transaction_record_state end else super end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activerecord-turntable-2.0.0.rc1 | lib/active_record/turntable/active_record_ext/transactions.rb |