DatabaseCleaner / database_cleaner-active_record

Strategies for cleaning databases using ActiveRecord. Can be used to ensure a clean state for testing.
MIT License
64 stars 63 forks source link

database cleaner breaks .reload in some cases? #11

Closed Hampei closed 1 year ago

Hampei commented 7 years ago

We have some code where we reload an instance and then call update_attributes.

instance.reload.update_attributes error: error, last_sync_failure: Time.now

After the update from 1.2.0 to 1.6.1 this suddenly fails because it's trying to do an insert instead of an update in the database (making a database restraint fail).

The really funny thing is

instance.reload.reload.update_attributes error: error, last_sync_failure: Time.now

works just fine. As does

instance.tap(&:restore_attributes).update_attributes error: error, last_sync_failure: Time.now

No time right now to create a small testrepo, but figured I'd mention it anyway.

No other gems or code where updated.

etagwerker commented 1 year ago

Very odd and probably not related to this gem.