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

Drive via Rails app #48

Merged
merged 6 commits into from
Sep 13, 2023
Merged

Drive via Rails app #48

merged 6 commits into from
Sep 13, 2023

Conversation

kaspth
Copy link
Owner

@kaspth kaspth commented Sep 12, 2023

I'm starting to dogfood the development with data that's more real. So to that end I've added a test/dummy Rails app akin to how Rails::Engine gem's work.

This app is a meal ordering site, so there'll both be a backoffice where restaurants can setup a menu items and prices, and then users can order those items.

See test/dummy/db/seeds/accounts/kaspers_donuts.rb for the Oaken bit. We wrote this file out first and then generated the models. Running bin/rails db:seed works! Though there's still some details to fix around #46 where we presume the data is cached.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Oaken file was written first and then used to drive out the bin/rails g model calls!

Comment on lines +1 to +2
Oaken::Seeds.preregister ActiveRecord::Base.connection.tables
Oaken::Seeds.load_from "db/seeds/accounts/kaspers_donuts"
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't quite integrated with bin/rails db:seed yet.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I messed around with this a bit a few days ago. Adding these Oaken::Seeds calls to a Railtie in the gem code nearly did the trick, but I ran into some circular include errors when trying to use this for both dev seeds and test data.

Did you have a specific approach in mind for abstracting this setup into the gem itself?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you have a specific approach in mind for abstracting this setup into the gem itself?

@blvrd not exactly yet, I still haven't settled on anything concrete. I think load_from has to change, but I don't know how yet.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I'll dig into it a bit more this week if I have some time.

@kaspth kaspth merged commit bbf2e42 into main Sep 13, 2023
2 checks passed
@kaspth kaspth deleted the drive-via-rails-app branch September 13, 2023 14:10
@kaspth
Copy link
Owner Author

kaspth commented Sep 13, 2023

Ok, this lets us dogfood and drive the development more through the app modeling. There's still work needed to use the Rails app in tests, which I'm not quite sure what that entails yet.

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.

None yet

2 participants