johnzablocki / couchbase-beer.rb

Couchbase 2.0 demo application using ruby programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Beer.rb

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://github.com/avsej/couchbase-beer.rb.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. 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
    
  6. Navigate to http://localhost:3000

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

Interesting Points

app/models/
├── 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.

About

Couchbase 2.0 demo application using ruby programming language