I would like to write a ruby script that will save the Json object stor开发者_开发百科ed in a file to Couchdb.
A code snippet to exmplain this would be very handy.
Here is all you want: Getting started with Ruby
I wrote a small script like this which did the trick for me!
require 'json' require 'rest_client' require 'couchrest' require 'pp'
json = File.read('file.json')
doc = JSON.parse(json)
CouchRest.post('http://localhost:5984/db/',doc)
pp doc
精彩评论