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

Add Active Record based setup. #14

Merged
merged 3 commits into from
Aug 9, 2023
Merged

Add Active Record based setup. #14

merged 3 commits into from
Aug 9, 2023

Conversation

kaspth
Copy link
Owner

@kaspth kaspth commented Aug 9, 2023

Swaps our tests over to transactional tests and removes the TODO for that.

We'll also start using Active Record based models as the default setup for now, memory.register SomeModel is still available for memory based ones.

I've also added a records.preregister setup so users shouldn't need to call register manually for all their Active Record based models. I still don't know where to automatically hook in to Active Record's boot and call it, or whether we can do it piecemeal for partial seeding. But this is a start!

kaspth added 3 commits August 9, 2023 19:24
This starts us off with a connection to a memory based SQLite connection as discussed in #5.

With transactional tests enabled we can now remove the TODO.

Closes #5
@kaspth kaspth merged commit 4592132 into main Aug 9, 2023
@kaspth kaspth deleted the active_record-setup branch August 9, 2023 17:52
@kaspth
Copy link
Owner Author

kaspth commented Aug 9, 2023

I looked into how Active Record dumps a schema into db/schema.rb to figure out the ActiveRecord::Base.connection.tables by the way. It's here: https://github.com/rails/rails/blob/main/activerecord/lib/active_record/schema_dumper.rb#L122

@kaspth kaspth mentioned this pull request Aug 12, 2023
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

Successfully merging this pull request may close these issues.

1 participant