だから、私は次のコード(connection.rb)があります。文字列http.request_postでRailsの3.2.12:初期化されていない一定のネット:: ReadTimeout
require 'net/http'
require 'net/https'
require 'openssl'
class Connection
def request
body = '<?xml version="1.0" encoding="UTF-8"?>...'
path = '/path'
http = Net::HTTP.new('192.168.12.34', '1234')
http.read_timeout = 60
p "=1"
http.request_post(path, body, {'Content-Type' => 'application/xml'})
p "=2"
...
rescue Net::ReadTimeout => ex
...
end
end
(...)を I出力を得る:
"=1"
NameError: uninitialized constant Net::ReadTimeout
/home/user/invp/lib/connection.rb:76:in `rescue in request'
/home/user/invp/lib/connection.rb:26:in `request'
/home/user/invp/lib/tasks/task.rake:225:in `block (2 levels) in <top (required)>'
私の環境:
[email protected]:~/invp$ ruby --version
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
[email protected]:~/invp$ rails --version
Rails 3.2.12
何が問題なの?