Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"current transaction is aborted" w/ v0.2.2 on Rails 4. #19

Open
melcher opened this issue Dec 5, 2013 · 0 comments
Open

"current transaction is aborted" w/ v0.2.2 on Rails 4. #19

melcher opened this issue Dec 5, 2013 · 0 comments

Comments

@melcher
Copy link

melcher commented Dec 5, 2013

Tried dropping in test_after_commit into my Rails project. My specs stalled out and gave the following error when trying to create record with an after_commit:

     ActiveRecord::StatementInvalid:
       PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block

My after-commit updates the record, but I didn't dig into it and see if that was the cause. Replacing this plugin with @bleonard's monkeypatch from #17 resolved the problem (copied below). Sorry I don't have more information, but thought this might be useful to anyone else who runs into the problem.

require 'active_record/connection_adapters/abstract/transaction'

module ActiveRecord
  module ConnectionAdapters
    class SavepointTransaction < OpenTransaction

      def perform_commit_with_transactional_fixtures
        out = perform_commit_without_transactional_fixtures
        commit_records if number == 1 # last one before test one that's always there, do callbacks
        out
      end
      alias_method_chain :perform_commit, :transactional_fixtures

    end
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant