rake task running in cron can't find database table

rake, ruby-on-rails, whenever

Solution

OK I got it now. It turns out I am only running this site on my own computer and have no production environment and hence no production database...

The whenever configuration should be:

every 1.hours do
   rake "scrape", environment => "development"
end

I also had to run whenever with the environment:

whenever -w --set environment=development

Problem

I have created the cron job with whenever (https://github.com/javan/whenever): ``` every 1.hours do rake "scrape" end ``` The rake scrape task runs fine when I run it manually, but when cron runs I get: ``` rake aborted! Could not find table 'beskeds' ``` The command run is: ``` /bin/bash -l -c 'cd /Users/klaus/Documents/src/Ruby/rails/fintra && RAILS_ENV=production bundle exec rake scrape --silent' ``` I am using RVM by the way

Original source