开发者

Net::SFTP keeps throwing errors in resque

I am running rails 3.1rc4 and keep running into this error message in my resque queues

uninitialized constant Net::SFTP With the exception "NameError"

In my gemfile I have included:

gem 'net-sftp'
gem 'net-ssh'
gem 'net-scp'

I included net-scp, just in case it was a dependency. I have tested my resque task externally 开发者_JAVA技巧of rails and redis with straight ruby, in which I required 'net/ssh' and 'net/sftp'. The whole thing worked perfectly. However the same resque task continually throws the uninitialized constant Net::SFTP. When I comment out the sftp section that comes before the Net::SSH section, I end up getting a similar error.

uninitialized constant Net::SSH

Do I need to change something in my gemfile or require these gems in my resque class? Why do I have to use 'net/ssh' in ruby while I have to use 'net-ssh' in my gemfile in rails?

Thanks in advance!


Have you loaded the environment in your rake task?

task "resque:setup" => :environment do
  # you can leave this blank
end

Resque, by default, runs standalone. If you need it to access things that are loaded by the app bundle, you need to load the environment.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜