Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Couchbase 2.0 demo application using ruby programming language
CSS JavaScript Ruby
branch: master

Update dependencies

Change-Id: I2216bd13f844e93292f801dbd32fda79bb582cdc
latest commit 3c4ac43b11
@avsej avsej authored
Failed to load latest commit information.
app Update dependencies
config Update dependencies
db Initial commit
lib Initial commit
log Initial commit
public Initial commit
script Initial commit
vendor Initial commit
.gitignore Initial beta upload (squashed)
Capfile Capify the application
Gemfile Update dependencies
Gemfile.lock Update dependencies
README.markdown refer to couchbaselabs repository
Rakefile Initial commit
config.ru Initial commit

README.markdown

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/couchbaselabs/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. 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

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.

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.

Something went wrong with that request. Please try again.