Rails couchdb demo application


I was trying to create a demo application using couchdb as backend. I faced to many challenges to create demo application.

– couchdb installation on ubuntu 12.10

– Deciding  ORM

– Create demo_app

– configure couchdb.yml file

– Initialize model attributes.

– Access couchdb data from UI interface.

Below are the step by step instruction to fix all above issues and create a demo application.

1.  couchdb installation on ubuntu 12.10

I already blogged Couchdb installation instruction from source code. followed all steps to install couchdb on your ubuntu machine.

2. ORM

I used ‘couchrest_model’ ORM. Install couchrest_model using as ruby gem.

$ sudo gem install couchrest_model

3. Create demo application

$ rails new rails_couchdb –skip-active-record

Add couchrest_model gem in your gemfile.

gem 'couchrest_model'

Do bundle update.

4. configure couchdb.yml file

$ rails generate couchrest_model:config

then create order scaffold.

$rails g scaffold order name:string details:text phone:integer email:string

5. Initialize model attributes.

You need to require couchrest_model in your rails order model.

require 'couchrest_model' 

and add field using properties keyword.

  property :name,      String
  property :details,      String
  property :phone,     Integer, :default => 95556236
  property :email,      String

Now start your rails server, you able to perform CRUD operation on order table.

6. Access couchdb data from UI interface.

Visit http://127.0.0.1:5984/_utils/  to access Couchdb data.

That’s it.

Enjoy….!!!!!!!!

 

 

Advertisements

2 thoughts on “Rails couchdb demo application

  1. We are impressed by the standard of information on this website. There are a lot of fine resources here. I am sure I’ll visit this area again quickly.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s