Posting the results of running the rake command with --trace always
helps, but I’d say the likely culprit here is something in your
environment / initializers. Does that function get called from
environment.rb or an initializer?
I have used “rake db:schema:dump” to generate a migration structure to
go from development to production. I want to use “rake
db:schema:load” to load it into my new database. Sounds like a plan.
When I run “rake db:schema:load” on the new database (development or
production), I get the following error:
Your rake task is picking up your development environment from
Here’s what you can do to start off with a clean production schema
provided you are the only one working on your db and you have
foolishly/wisely modified your db schema without going through a proper
perform a rake db:schema:dump
remove all prior migration files
perform a rake db:migrate
open the migration file just created, and cut and paste the contents
from the schema.rb file that you created in step 1. (during the paste,
just copy the relevant parts, avoid the database create part…)
Now you can use that migration file on production
Ask that girl in finance out on a date like you promised yourself 2
WHY does db:schema:load run queries against my database when the
data (and tables) aren’t there?
HOW do I fix this so it won’t happen again?
rake db:schema:load requires the environment task (which loads your
app config and so on)
in production config.cache_classes is true, which means that your
applications models are loaded
your Mojo model is loaded, and reaches the line