search for: rollback_db_transaction

Displaying 7 results from an estimated 7 matches for "rollback_db_transaction".

2006 Jun 15
4
testing with transactions
...ansaction begin_db_transaction transaction_open = true else savepoint_name = create_savepoint savepoint_open = true end yield end rescue Exception => database_transaction_rollback if transaction_open transaction_open = false rollback_db_transaction end if savepoint_open savepoint_open = false rollback_to_savepoint(savepoint_name) end raise end ensure commit_db_transaction if transaction_open release_savepoint(savepoint_name) if savepoint_open end Best regards, Laas
2006 Apr 03
4
How to fake composite primary keys?
I know ActiveRecord doesn''t support composite primary keys, but I need to use one, and I need it ASAP. I don''t need any composite foreign keys, luckily; what I have is a table that stores old versions of rows in another table, so the composite key is an id + date stamp. Would someone tell me a hack I can use to support this? -- View this message in context:
2006 Oct 20
2
how do you manually cause a rollback in a transaction?
how do you manually cause a rollback in a transaction? I''ve looked everywhere with no suceess. Anyone know? Thanks in advance Chris -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2008 Mar 14
0
Adding before / after blocks to every spec
...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''] = 0 end end def self.included(base) base.before(:each) { begin_transaction } base.after(:each) { rollback_transaction } end end end end and I''m including it in a spec_helper li...
2006 Oct 17
3
Should fixtures be transactional?
I started using the new Model.should_have(1).records expectation in rspec_on_rails, and quickly realized that my fixtures were remaining loaded, even in contexts that didn''t use them. Bug or feature? Jay Levitt
2007 Oct 08
3
test not rolling back
...eturn unless defined?(ActiveRecord::Base) && ! ActiveRecord::Base.configurations.blank? # Rollback changes if a transaction is active. if use_transactional_fixtures? && Thread.current[''open_transactions''] != 0 ActiveRecord::Base.connection.rollback_db_transaction Thread.current[''open_transactions''] = 0 end ActiveRecord::Base.verify_active_connections! end and I found that Thread.current[''open_transactions''] equals zero in these cases. anyone else encounter this or see something I''...
2012 Apr 27
3
rails console --sandbox is only half-baked
...-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 databases, only the default one will be sandboxed. Additionally, there is another design issue. For example, Sequel was design...