dohzya
7/25/2007 6:04:00 PM
Le jeudi 26 juillet 2007 à 01:25 +0900, Pit Capitain a écrit :
> 2007/7/24, dohzya <dohzya@gmail.com>:
> > I have a problem with bidirectional relations : how to implements it ?
> > (...)
> > If anyone has a suggestion (solution or link or anything) to implement
> > transparent bidirectional relation... :)
>
> Hi Etienne,
>
> in ruby-talk:121602 I posted a little library to implement this.
> Here's your example:
>
> require "relation"
>
> class Entity
> end
>
> Relation.new Entity, :one, :mother, Entity, :many, :daughters
>
> a = Entity.new
> b = Entity.new
>
> a.mother = b
> puts(b.daughters.include?(a)) # => true
>
> a.daughters << b
> puts(b.mother == a) # => true
>
>
> If you find nothing else maybe I should create my first gem...
>
> Regards,
> Pit
>
Why find again ? it's exactly what I want !
I wait for your gem, thanks :)
--
Etienne