It’s happened to me twice in the last couple of weeks, and this time I knew exactly what I’d done, so here’s the solution if you make the same bad and non-“Rails Way” mistake I did.
dave@infinity:~/$ rake RAILS_ENV=production db:schema:load
Mysql::Error: Table 'special_production.pages' doesn't exist: SHOW FIELDS FROM `pages`
(See full trace by running task with --trace)
In my routes.rb file I had specified a route as such:
# map.connect 'special-day', :controller => 'pages', :action=>'show',
DON’T DO THIS. Not sure in what way it struck me as an overly good idea, but just don’t.
Strip that route out of your code and if necessary replace it as such:
# map.connect 'special-day', :controller => 'pages', :action=>'special-day'
What threw me about this problem is that I thought there was an issue in my schema.rb or migrations, this isn’t the case: ‘rake’ is trying to load the environment and falls over because ‘Pages’ hasn’t got going yet.
Don’t forget when you’re finished you may need to re-setup and migrate (cap deploy:setup / cap deploy:migrations) before your site will go.
P.S. This (silliness) never went into production!