I ran into a "chicken before the egg" problem where a gem was expecting the tables to be present when loaded which was fine until you try and build the db from scratch using db:setup. When it hits db:schema:load the environment loads and the gem errors out as the tables aren't present. I made a custom task that connected to ActiveRecord and then loads the schema file. Using essentially the same methods as db:create uses to create the db and schema:load uses to load the schema. This seems to work without problems.
Is there a reason the environment is normally loaded for this task? Just wondering If I'm missing something that'll kick me in the ass later.
but they don't say why they decided to load or not load the env at the time.
Cheers,
Brian