Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Transaction strategy works with ActiveRecord and multiple databases #107

Merged
merged 1 commit into from Aug 25, 2012

Conversation

Projects
None yet
3 participants
Contributor

kazjote commented Mar 7, 2012

It works with rails 3 and should not crash rails 2.3.

I would love to test it but could not setup testing environment correctly. I tried with the environment from .rvmrc but it does not work as project uses ruby 1.9 hashes syntax at lib/database_cleaner/sequel/transaction.rb.

With ruby 1.9 I could not install whole bundle as it depends on a gem not ready for ruby 1.9.

Please, let me know how to run testcase. I am probably missing something...

johnf commented on cab0ac2 Jun 11, 2012

This just solved my hours of soul searching getting multiple databases working. For truncation in my case. Maybe this is a rails 3.2 thing?

Contributor

johnf commented Jun 11, 2012

This just solved my hours of soul searching getting multiple databases working. For truncation in my case. Maybe this is a rails 3.2 thing, since I'm sure I've had this working wth < 3.2.

Contributor

kazjote commented Jun 11, 2012

We use it currently with rails 3.2.2

If you change strategy, you have to set strategy separately for each database.

If you have 3 databases (your test, test_sps, test_ids) you have to do following:

  DatabaseCleaner.strategy = strategy
  DatabaseCleaner[:active_record, {:connection => :test_sps}].strategy = strategy
  DatabaseCleaner[:active_record, {:connection => :test_ids}].strategy = strategy

bmabey added a commit that referenced this pull request Aug 25, 2012

Merge pull request #107 from kazjote/multiple_db_ar_transactions
Transaction strategy works with ActiveRecord and multiple databases

@bmabey bmabey merged commit a469347 into DatabaseCleaner:master Aug 25, 2012

Contributor

bmabey commented Aug 25, 2012

Merged in, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment