We're using the links and was going to implement pretty much what you recommend. It wouldn't seem to hard to implement this kind feature via some meta-programming in Ripple, another one for the feature backlog maybe.
Thanks M. On Feb 11, 2011, at 12:56 PM, Sean Cribbs wrote: > Mat, > > In Riak you would implement this pattern with links. Ripple helps you do > similar queries to has_many :through, but there is no automatic thing for it > yet (it needs some more thought). In the meantime, do this: > > class Publisher > include Ripple::Document > many :authors > > def books > authors.map {|a| a.books }.flatten > end > end > > Sean Cribbs <s...@basho.com> > Developer Advocate > Basho Technologies, Inc. > http://basho.com/ > > On Feb 11, 2011, at 3:39 PM, Mat Ellis wrote: > >> We're still thoroughly in an ActiveRecord mindset over here. Before we go >> and build some simple collect statements to replace a few has_many :through >> statements, is there some Ripple or Riak goodness we should be using instead? >> >> Example: >> >> * A Publisher has many Authors who have many Books >> * We want to get a set of books for a given publisher >> * In ActiveRecord we would say: >> >> # publisher.rb >> class Publisher < ActiveRecord::Base >> has_many :authors >> has_many :books, :through => authors >> end >> >> # author.rb >> class Author < ActiveRecord::Base >> belongs_to :publisher >> has_many :books >> end >> >> # book.rb >> class Book < ActiveRecord::Base >> belongs_to :author >> end >> >> Thanks >> >> M. >> >> >> _______________________________________________ >> riak-users mailing list >> riak-users@lists.basho.com >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > _______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com