For those of you who might be using your engine as a git submodule in a bigger project, here is what I've settled on (riffed a bit from https://github.com/pat/combustion/issues/13#issuecomment-99608773). I will admit that a bit of the final result is due to trail/error. For instance, I don't really know what the
task :environment block does, but I know when I run
rake db:migrate, it executes that block, and thus requires additional requires.
If someone else has a clearer understanding of how everything is fitting together, please let me know and I'll update
We do not need to modify db paths in the Rakefile because we've set those up as initializers in the
engine.rb so that the main app pulls migrations and
schema.rb from the core project. (Bonus points for loading FactoryBot factories to be reused in the main app!)