Displaying 3 results from an estimated 3 matches for "increment_open_transact".
2008 Apr 04
2
TransactionError
...rom /usr/local/bin/mongrel_rails:16
"Transaction aborted" is in activerecord/lib/active_record/transactions.rb:
module ClassMethods
def transaction(&block)
previous_handler = trap(''TERM'') { raise TransactionError, "Transaction aborted" }
increment_open_transactions
begin
connection.transaction(Thread.current[''start_db_transaction''], &block)
ensure
decrement_open_transactions
trap(''TERM'', previous_handler)
end
end
[...]
Above this, there''s
"Both Base#sav...
2008 Mar 14
0
Adding before / after blocks to every spec
...module for merb that will run all
specs within an ActiveRecord (initially) database transaction - to
give functionality similar to rails transactional fixtures.
Here is the module:
module Merb
module Test
module TransactionalSpecs
def begin_transaction
ActiveRecord::Base.send :increment_open_transactions
ActiveRecord::Base.connection.begin_db_transaction
end
def rollback_transaction
if Thread.current[''open_transactions''] != 0
ActiveRecord::Base.connection.rollback_db_transaction
Thread.current[''open_transactions'...
2012 Apr 27
3
rails console --sandbox is only half-baked
...m/forum/?fromgroups#!msg/sequel-talk/VjfJcTD6s3w/Lbrc2RqVuu8J
<https://groups.google.com/forum/?fromgroups#%21msg/sequel-talk/VjfJcTD6s3w/Lbrc2RqVuu8J>
Here is how sandbox is handled by ActiveRecord:
activerecord/lib/active_record/railties/console_sandbox.rb:
ActiveRecord::Base.connection.increment_open_transactions
ActiveRecord::Base.connection.begin_db_transaction
at_exit do
ActiveRecord::Base.connection.rollback_db_transaction
ActiveRecord::Base.connection.decrement_open_transactions
end
This only handles the default database as noticed by Jeremy. If you have
models relying on different datab...