#14 ✓duplicate
Oleg Andreev

has_many association based on Views

Reported by Oleg Andreev | April 28th, 2008 @ 02:43 AM | in 0.0.3

Article = Meta.new do
  has_many :comments

BlogPost = Meta.new do
  has_many :comments

produces =>

View.define(:name => "has_many_comments") do |v|
  def v.map(uuid, doc)
    [ [ [doc['belongs_to'], doc['created_at']], doc ] ] if doc.is_a? Comment

Comment.new(... :belongs_to => some_article )
some_article.comments # => list of all comments

This view is compatible with all the comment containers, defined at any time.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

StrokeDB is an embeddable distributed document database written in Ruby

Shared Ticket Bins

People watching this ticket

Referenced by