Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Transaction fixtures don't work if model has a different connection than ActiveRecord::Base

#3395

When using transactional fixtures each example is wrapped in a database transactions. This transaction is started on ActiveRecord::Base's connection. However if you use fixture for a model that has a different connection, any changes to this model are not inside of a transaction. This means that changes to this table accumulate and are not reset between examples.

The solution should be fairly simple. Instead of only using database transaction on AR::Base, start a transaction against every connection referred to by a model.

attached is a diff based on Rails 2.2.2 which illustrates the basic idea. I'll create a proper patch against HEAD shortly, as well as write some test.

Reported by Andrew Selder · October 20th, 2009 @ 05:28 AM

State: stale
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Andrew Selder
    Andrew Selder

    The diff is against fixtures.rb in case it wasn't clear.

    October 20th, 2009 @ 05:29 AM

  2. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to stale
    • Importance changed from to

    Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.

    October 6th, 2010 @ 06:37 AM