Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
86 lines (64 sloc) 3.13 KB


This application demostrate the how to write rails application using Couchbase 2.0 server.

Installation & Configuration

  1. Install recent Couchbase server 2.0 (beta)

  2. Checkout this application

     git clone git:// beer.rb
  3. Install all dependencies

     cd beer.rb
     gem install bundler
     bundle install
  4. Update config/couchbase.yml if needed, or just inspect its contents

     cat config/couchbase.yml
  5. If you are going to use couchbase as rails cache store (by default) you should either create "cache" bucket or fix the appropriate line in config/application.rb. It might be good idea to use memcached type of the bucket for the cache.

  6. Run the application. It will use thin server, you would like to use another one, you should update Gemfile (comment out the thin gem there).

     rails server
  7. Navigate to http://localhost:3000

  8. Optionally. If you are going to deploy application using capistrano, you should update config/deploy.rb.

Interesting Points

├── beer
│   ├── all
│   │   └── map.js
│   └── by_category
│       ├── map.js
│       └── reduce.js
├── beer.rb
├── brewery
│   ├── all
│   │   └── map.js
│   ├── all_with_beers
│   │   └── map.js
│   ├── by_country
│   │   ├── map.js
│   │   └── reduce.js
│   └── points
│       └── spatial.js
└── brewery.rb

The application use two models: Beer and Brewery. Also it defines views for them, you can find them in corresponding directories app/models/beer and app/models/brewery. You can read more about this directory structure in the README of the couchbase-model ruby gem.

Couchbase as a cache storage: there is another bucket should be configured and mentioned in config/application.rb:68 to replace default cache store in Rails and use Couchbase server instead.

Couchbase as a session storage: just take a look at config/initializers/session_store:10 for further instructions. You probably will need to create yet another bucket for sessions.