I'm working on my first project involving Rails Engines, and there's some kind of disconnect for me between the Rails Guides and what is happening in my application. There are several references in the guides to an /engines directory in the parent application, yet when I put my engine (under development) in that hierarchy within the parent application, any migrations or models or controllers I try to generate later (by navigating into [parent app]/engines/my_engine and running the relevant rake or rails command there) ends up being executed by the parent app, and the files end up in the parent app as well.
As a test, I just followed the directions in the Guide, but built my engine as a separate Rails app, outside of any parent app, so I now have /sites/my_engine and sites/parent_app side by side. (The gem is added with the path: ../my_engine) This seems to work much better -- when I run the generators in the engine, their output is confined to that engine. And then, when I use the rake my_engine:install:migrations task, the new migrations are properly copied out into the parent app, and can be run there.
This is more of what I was expecting, because the canonical examples (Devise, Forem, etc.) are all run that way -- views, controllers, and models all live in the gem/engine and any migrations needed are installed in the parent app during gem installation and run there.
But none of this then leaves me with an /engines directory, unless I'm missing something.
Could someone who has done this sort of thing before point me to what I'm doing to diverge from the path?
Is it as stupid as me needing to prefix the rails or rake command with ./bin/ so it's painfully obvious *which* rails I mean? Or is it a case of the docs lagging behind the actual code? I'm using Rails 5.1 for this (and following the 5.1 version of the Guides) if that's another point of difference.