Module: Ripple::Document

Extended by:
ActiveSupport::Concern
Defined in:
ripple/lib/ripple/document.rb,
ripple/lib/ripple/document/key.rb,
ripple/lib/ripple/document/finders.rb,
ripple/lib/ripple/document/persistence.rb,
ripple/lib/ripple/document/bucket_access.rb

Overview

Represents a model stored in Riak, serialized in JSON object (document). Ripple::Document models aim to be fully ActiveModel compatible, with a keen eye toward features that developers expect from ActiveRecord, DataMapper and MongoMapper.

Example:

  class Email
    include Ripple::Document
    property :from,    String, :presence => true
    property :to,      String, :presence => true
    property :sent,    Time,   :default => proc { Time.now }
    property :body,    String
  end

   = Email.find("37458abc752f8413e")  # GET /riak/emails/37458abc752f8413e
  .from = "someone@nowhere.net"
  .save                               # PUT /riak/emails/37458abc752f8413e

  reply = Email.new
  reply.from = "justin@bashoooo.com"
  reply.to   = "sean@geeemail.com"
  reply.body = "Riak is a good fit for scalable Ruby apps."
  reply.save                               # POST /riak/emails (Riak-assigned key)

Defined Under Namespace

Modules: BucketAccess, ClassMethods, Finders, InstanceMethods, Key, Persistence