loading data from mysql into couchdb with rest and ActiveRecord

Posted by phillip Sun, 20 Jul 2008 22:19:00 GMT

$KCODE = 'u'

require 'rubygems'
require_gem 'activerecord'
require 'rest_client'

class MyModel < ActiveRecord::Base
end

ActiveRecord::Base.establish_connection(
  :adapter => "mysql", 
  :database => "hello_world", 
  :encoding => 'UTF8'
)

MyModel.find(:all).each do |record|
  p RestClient.post('http://localhost:5984/hello_world', record.to_json)
end

Posted in ,  | Tags , , , , ,  | no comments | no trackbacks

Comments

Trackbacks

Use the following link to trackback from your own site:
http://me.phillipoertel.com/trackbacks?article_id=loading-data-from-mysql-into-couchdb-with-rest-and-activerecord&day=21&month=07&year=2008

Comments are disabled