lib/carrierwave/storage/ftp.rb in carrierwave-ftp-0.2.6 vs lib/carrierwave/storage/ftp.rb in carrierwave-ftp-0.2.7

- old
+ new

@@ -90,13 +90,20 @@ end rescue end def connection - ftp = ExFTP.open(@uploader.ftp_host, @uploader.ftp_user, @uploader.ftp_passwd, @uploader.ftp_port) - ftp.passive = @uploader.ftp_passive - yield ftp - ftp.close + ftp = ExFTP.new + ftp.connect(@uploader.ftp_host, @uploader.ftp_port) + + begin + ftp.passive = @uploader.ftp_passive + ftp.login(@uploader.ftp_user, @uploader.ftp_passwd) + + yield ftp + ensure + ftp.close + end end end end end end