Hello –
Is there some trick to using Net::SFTP within a Rails model? I keep
getting the following error and for the life of me I can’t figure it
out. The code works fine outside the model context (i.e. in a ruby
console):
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/debug.rb:121:in
orig_open' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/debug.rb:121:in
open’
c:/ruby/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/sftp/operations/open.rb:27:in
perform' c:/ruby/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/sftp/operations/abstract.rb:64:in
execute’
c:/ruby/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/sftp/session.rb:253:in
method_missing' c:/ruby/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/sftp/session.rb:177:in
open_handle’
c:/ruby/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/sftp/session.rb:203:in
`put_file’
The code is just:
Net::SFTP.start(@sftp_server, @sftp_login, @sftp_password) do |sftp|
sftp.put_file self.path, “/home/blah-blah/dir”
end
Cheers,
Jake
You didn’t really give us the error…just the stack trace. Can
you tell us exactly what exception is being thrown?
–Jeremy
On 2/13/07, Jake J. [email protected] wrote:
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/debug.rb:121:in
`put_file’
Jake
–
Posted via http://www.ruby-forum.com/.
–
http://www.jeremymcanally.com/
My free Ruby e-book:
http://www.humblelittlerubybook.com/book/
My blogs:
http://www.rubyinpractice.com/
Oops. It’s just:
can’t convert nil into String
But it’s not from any of my stuff being ‘nil’. The trace comes down to
these lines in Net::SFTP::open.rb:
# Performs the operation.
def perform( path, flags=IO::RDONLY, mode=0660 )
@driver.open( nil, path, flags, mode )
end
I’m guessing it’s that first nil there, but I’m having some trouble
figuring out what’s going on.
Jake
Jeremy McAnally wrote:
You didn’t really give us the error…just the stack trace. Can
you tell us exactly what exception is being thrown?
–Jeremy
On 2/13/07, Jake J. [email protected] wrote:
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/debug.rb:121:in
`put_file’
Jake
–
Posted via http://www.ruby-forum.com/.
–
http://www.jeremymcanally.com/
My free Ruby e-book:
http://www.humblelittlerubybook.com/book/
My blogs:
http://www.mrneighborly.com/
http://www.rubyinpractice.com/