Removing properties in Ripple

Duff OMelia duff at
Tue Feb 8 18:29:40 EST 2011

Hi all,

There's a test in ripple:

describe Ripple::Document::Finders do
    it "should raise an exception when finding an existing document
that has properties we don't know about" do
      @plain.raw_data = '{"non_existent_property":"whatever"}'
      lambda { Box.find("square") }.should raise_error

I'd like to understand the motivation for that behavior.
Specifically, if we have data stored in Riak and we want to eliminate
one of the Ripple properties, what's the best way to do that?  So for
example, if we had:

class Account
  include Ripple::Document

  property :email, String, :presence => true
  property :feature_level, String


And then we wanted to change the Account to look like this:

class Account
  include Ripple::Document

  property :email, String, :presence => true


such that it no longer has the feature_level property, then we can't
find existing Accounts using Ripple because it'll raise an exception.

I was thinking I'd be able to find one of those old accounts,
potentially access the feature_level using the attributes from
ActiveModel, potentially remove that feature level from the Riak
storage, etc.  The fact that there's a test there verifying that
finding a document with unknown properties raises an exception makes
me think there's something I'm missing as far as renaming properties
or deleting old data goes.

Anyone have any insight to share?


Duff OMelia

More information about the riak-users mailing list