Monday, July 26, 2010

Ruby 1.9.2, Rails 3, Riak and Ripple

Here is a simple example to get you started.

Prerequisites

  1. Install Riak via Homebrew (brew install riak)
  2. Install Ruby 1.9.2 via RVM (rvm install 1.9.2-rc2)
  3. Rails3 via RubyGems (gem install rails --pre)

Version Disclosure
This is what I'm using.  Things change, and YMMV.
  • Ruby 1.9.2 RC2
  • Rails 3 Beta 4
  • Ripple edge (cb087f6)
  • Riak 0.12.0 on Erlang R13B04

Step By Step
  1. > rails new myapp
  2. > cd myapp
  3. Edit Gemfile like so:

    source 'http://rubygems.org'
    gem 'rails', '3.0.0.beta4'
    gem 'ripple', :git => 'http://github.com/seancribbs/ripple.git'
    gem 'curb'

  4. > bundle install
  5. Edit config/database.yml like so:

    ripple:
      development:
        port: 8098
        host: localhost

  6. Create app/models/post.rb:

    require 'ripple'
    class Post
      include Ripple::Document
      property :title,   String, :presence => true
      property :body,    String
    end

  7. > riak start
  8. > rails console
Have Fun!



0 comments: