我在 /lib/tasks 文件夹下以这种方式编写的应用程序中有一个 rake 任务
task :import_feed => :environment do
url = "url"
decode json here
post=Post.new
post.attributes
post.save
end
每次我运行此任务时,我都会收到未配置暂存数据库的错误消息。不管我是做 RAILS_ENV=production 还是 RAILS_ENV=development。这可能是什么原因?