我在按时执行预定作业时遇到问题。
在我的config / schedule.rb中:
every 1.minutes do
runner "Ubike.update"
end
该功能在控制台中正常运行,但我在日志中收到此错误消息:
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.1/lib/rails/commands/runner.rb:53:in `eval': Could not find table 'ubikes' (ActiveRecord::StatementInvalid)
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:399:in `columns'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/schema_cache.rb:114:in `block in prepare_default_proc'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/schema_cache.rb:56:in `yield'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/schema_cache.rb:56:in `columns'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.1/lib/active_record/model_schema.rb:208:in `columns'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.1/lib/active_record/model_schema.rb:217:in `columns_hash'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.1/lib/active_record/relation/delegation.rb:14:in `columns_hash'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.1/lib/active_record/relation/finder_methods.rb:278:in `find_one'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.1/lib/active_record/relation/finder_methods.rb:268:in `find_with_ids'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.1/lib/active_record/relation/finder_methods.rb:35:in `find'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-deprecated_finders-1.0.3/lib/active_record/deprecated_finders/relation.rb:122:in `find'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-4.0.1/lib/active_record/querying.rb:3:in `find'
from /Users/tsengdavid/Documents/Rails/BikeTraffic/app/models/ubike.rb:10:in `update'
from (eval):1:in `<top (required)>'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.1/lib/rails/commands/runner.rb:53:in `eval'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.1/lib/rails/commands/runner.rb:53:in `<top (required)>'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.1/lib/rails/commands.rb:84:in `require'
from /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.1/lib/rails/commands.rb:84:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
我在&#34; Could not find table 'users'&#34;中的类似问题中尝试rake db:test:prepare
但我仍有同样的问题。