我无法使用couchrest_model库连接到bluemix上托管的我的cloudant NoSQL数据库。从ruby连接到cloudant NoSQL数据库
我用Ruby编写的类似代码的工作从我的电脑就好了(本地运行,无轨或西纳特拉):
require 'couchrest'
url = "https://[email protected] with credentials.com"
database_name = "testdb"
db = CouchRest.database!(url+"/"+database_name)
db.save_doc('_id':"dog",:name => 'MonthyPython', :date => Date.today)
doc = db.get('dog')
上面的代码成功地将数据写入到我的数据库。然而,当我试着做了最新的“couchrest_model”宝石类似的事情,我得到了
/Users/userpruser/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:933:in `connect_nonblock': SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol (OpenSSL::SSL::SSLError)
我观看了几页,但没有运气。那么,使它与ruby(无轨)或/和ruby + sinatra一起工作的正确方法是什么?我找到这个配方http://recipes.sinatrarb.com/p/models/couchdb,但我不知道如何sed evnroment变量,以及如何把它放在一起。
感谢您的帮助!
我已经添加了ibm-bluemix标签以获得更广泛的可见性。您也可以尝试通过电子邮件发送到[email protected]。 – ralphearle
谢谢,我会尽力的。我也会尝试编辑评论并发布其他一些代码。 –