Ripple & an attribute named 'key'

Sean Cribbs sean at basho.com
Sat Feb 12 22:47:40 EST 2011


The choice of "key" as the method/attribute name corresponds to the Riak terminology for the same concept (and is analogous to "id" in ActiveRecord).  If you want to use a non-String value for the key, create a property of some other name and then use the "key_on" method which makes a defined property act as the key.

property :some_num, Integer, :presence => true, :default => 1234
key_on :some_num

Sean Cribbs <sean at basho.com>
Developer Advocate
Basho Technologies, Inc.
http://basho.com/

On Feb 12, 2011, at 8:00 PM, Mat Ellis wrote:

> Why do these behave differently in Ripple?
> 
> # Leaves key field blank
> property :key, Integer, :presence => true, :default => 1234
> 
> # Populates key2 field with 1234
> property :key2, Integer, :presence => true, :default => 1234
> 
> We'd like to use the key field as a standard (like the 'id' field is the default in ActiveRecord). Is this a bad idea and if so why?
> 
> M.
> 
> 
> 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com




More information about the riak-users mailing list