我想在延迟作业中调用 redirect_to 函数。我有文件 print_job.rb
class PrintJob < Struct.new(:device,:survey,:filter_tags,:day1,:day2,:lastsurvey, :scale)
def perform
pc = PagesController.new
pc.redirect_to "http://google.com"
#pc.redirect_to :action => "print", :format => "pdf", :device => device, :survey => survey, :filter_tags => filter_tags,
#:day1 => day1, :day2 => day2, :lastsurvey => lastsurvey, :scale => scale
end
def success(job)
end
end
但它不起作用。如果我只是把redirect_to“htpp://google.com”。它说没有方法redirect_to
现在的情况是我正在使用带有延迟作业的 pdf 工具包,但没有直接导出 pdf 文件。我有链接 locahost/print 如果我想以 pdf 格式打开它,只需输入 localhost/print.pdf 或使用 link_to :action => "print", :format => "pdf" 但是如果 pdf 文件很大,它性能不佳,所以我想在延迟作业中打开 localhost/print.pdf。那么我该如何解决这个问题
那么我现在如何在延迟工作中调用 redirect_to 呢?谢谢!