You can use Ripple::EmbeddedDocument to achieve something similar. Here is a sample model, Authorization, that embeds UserInfo as an association: https://github.com/dreverri/favorite_color/blob/master/server/lib/favorite_color/models/authorization.rb https://github.com/dreverri/favorite_color/blob/master/server/lib/favorite_color/models/user_info.rb
UserInfo is stored inside the Authorization model in Riak. Thanks, Dan Daniel Reverri Developer Advocate Basho Technologies, Inc. [email protected] On Fri, Jun 17, 2011 at 2:21 PM, Thomas Fee <[email protected]> wrote: > Hello, Ripple users. > > One thing nice about OpenStruct in Ruby - you can use the same class for > many "types" of instances. I desire the same for Ripple - something like > OpenStruct, with ability to subclass and specialize, then "embed inline", > i.e. to nest. > > To illustrate, something like the following, with a custom class > (ExtProperty) analogous to a subclass of OpenStruct... > > class ExtProperty > include Ripple::NestedDocument ## New thingy > property :text, String > property :source, String > property :code, Integer > end > > class Contract > include Ripple::Document > property :product_code, ExtProperty > property :contract_unit, ExtProperty > property :price_quotation_unit, ExtProperty > property :floating_price_definition, ExtProperty > end > > I can currently get part of this with the Ripple::NestedAttributes > construct, but it lacks a defined class. I would have to explicitly convert > a hash to a desired class, and vice versa. And also, the top-level class > wouldn't specify the nested class, if you were to think of the class > definition as a data model definition. > > Any plans for something like what I described? > > - Tom > > _______________________________________________ > riak-users mailing list > [email protected] > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > >
_______________________________________________ riak-users mailing list [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
