Fix transactions for Rails 4