database_rewinder icon indicating copy to clipboard operation
database_rewinder copied to clipboard

Support activerecord-import gem

Open teohm opened this issue 8 years ago • 1 comments

Hi, any plan to support activerecord-import gem?

We use activerecord-import in production code, and use DatabaseRewinder.clean in our tests.

When we run tests on activerecord-import related codes to perform bulk inserts, DatabaseRewinder#record_inserted_table is not being called at all.

Do you think it's possible to track bulk INSERT SQL statement executed by activerecord-import gem? I'm happy to submit a PR but I need some guides to figure out which part needs to be changed 🙇

teohm avatar Apr 21 '16 02:04 teohm

if you are using Rails (< 5.0) and Postgres, updating to Rails 5.1 will make DatabaseRewinder#record_inserted_table work properly.

because Rails 5.1 select_rows and select_values now call exec_query that overrided from here ( https://github.com/amatsuda/database_rewinder/blob/master/lib/database_rewinder/active_record_monkey.rb )

naari3 avatar Dec 18 '19 18:12 naari3