Tequila Rails Patch, Part 2. r:awesome

Changes previously cherry-picked from Rails 3.2.x to
tracksimple/rails/ts_rails_with_remember_record_state_3_1_1:

https://github.com/tracksimple/rails/commit/354c36a
    when the transactional fixtures keeps a database transaction
    alive without using the transaction method, don't retain
    references to all the records saved in the fixtures transaction
    once their subtransaction completes

https://github.com/tracksimple/rails/commit/4515324
    expose :remember_record_state => false option on transaction(),
    so applications that don't need state rollback (or
    after_commit/rollback hooks) can garbage collect the records
    during long transactions

https://github.com/tracksimple/rails/commit/ded32e7
    Add ActiveRecord::Relation#uniq for toggling DISTINCT in the
    SQL query

https://github.com/tracksimple/rails/commit/b1eff91
    Use uniq instead of manually putting a DISTINCT in the query