class WeatherController < ApplicationController
def data
@weather = Weather.all #show data in data.html.erb
e = Extractor.new
e.saveData
end
end
这是我的 Controller 中的一段代码,我使用 Extractor 从网页中获取数据并将它们显示在 localhost:3000/weather/data 上。 现在我想每 10 分钟在后台运行一次 e.saveData,但不刷新我的页面,你能帮帮我吗。
最佳答案
关于ruby-on-rails - 使用 ruby on rails 运行后台任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29774785/