我一直在我的resque失败的工作中一遍又一遍地收到这个错误
Errno :: ENOENT没有这样的文件或目录
我的视频控制器中有后台任务
def phoneupload
@video = current_user.videos.build(video_params)
if @video.save
Resque.enqueue_at(2.minutes.from_now, MobileUpload, @video.id)
Resque.enqueue_at(15.minutes.from_now, VideoImageurl, @video.id)
redirect_to videos_path, notice: 'Video was successfully Posted!'
else
render action: 'new'
end
end
这是我的MobileUpload工作人员
class MobileUpload
@queue = :video_queue
def self.perform(video_id)
require 'open-uri'
require 'net/http/post/multipart'
require 'json'
video = Video.find(video_id)
path_to_video = video.phoneupload.url
uri = URI('https://upload.wistia.com/')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
# Construct the request.
request = Net::HTTP::Post::Multipart.new uri.request_uri, {
'api_password' => 'my_secret_api',
'project_id' => 'my_proect_id', # Optional.
'file' => UploadIO.new(
File.open(path_to_video),
'application/octet-stream',
File.basename(path_to_video)
)
}
# Make it so!
response = http.request(request)
result = JSON.parse(response.body)
hashed_id = result['hashed_id']
self.update_attribute(:wistiaid, hashed_id)
save!
end
end
我的工作人员这一行
path_to_video = video.phoneupload.url
正在拉我上传的视频网址,我使用了回形针。路径被正确拉出但不起作用?