This application demostrate the how to write rails application using Couchbase 2.0 server.
Install recent Couchbase server 2.0 (beta)
Checkout this application
git clone git://github.com/couchbaselabs/couchbase-beer.rb.git beer.rb
Install all dependencies
cd beer.rb gem install bundler bundle install
Update config/couchbase.yml if needed, or just inspect its contents
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.
Run the application. It will use
thinserver, you would like to use another one, you should update Gemfile (comment out the thin gem there).
Optionally. If you are going to deploy application using capistrano, you should update config/deploy.rb.
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.