resque job ActiveRecord::StatementInvalid Could not find table
I h开发者_JAVA技巧ave a resque-scheduler delayed job that is queued properly. Everything is working nice an smootly on dev machine. Once deployed the job get executed but failed. resque-web shows on the failed job tab the following error:
Exception: ActiveRecord::StatementInvalid
Error: Could not find table 'articles'
The table articles exists, as I'm accessing it through the app.
Any clue?
I initially was starting the appropriate resque tasks manually on the server and got the error. I changed the deployment strategy and ended up adding the resque task in the capistrano recipe...and it worked !!! another mystery solved. I guess the explanation is a mix of not being in the same rails context and user privileges.
You are probably missing the RAILS_ENV environment variable and Resque tries to use development database (which is not existing). This should work if you run the rake from the command line:
RAILS_ENV=production QUEUE=* rake resque:work
精彩评论