You may want to look at the dm-is-tree or dm-is-nested plugins.

Any reason why it's a single table inheritance?

On Apr 13, 7:05 am, sfeu <[email protected]> wrote:
> Hey,
>
> i am trying to figure out how i can manage the following mixture of
> inheritance and
> associations in Datamapper. Unfortunately i cannot browse through the
> associations
> so far. Maybe its a problem with the adapters as well - i realized
> that there is no standardized
> test suite available so far - or am i wrong?
>
> It would help me a lot if someone could point me out the correct way
> of specifying the following
> relationships. Then i could take a look into the adapters myself.
>
> I am still using 0.10.1
>
> Thx,
> Sebastian
>
>  class Element
>      include DataMapper::Resource
>      property :id, Serial
>      property :type, Discriminator
>      property :name, String, :key => true
> end
>
> class File < Element
>     property :size, String
>     belongs_to  :parent, 'Folder',
>                      :parent_key => [ :id ],
>                       :child_key  => [ :folder_id ],
>                      :required   => true
> #     belongs_to  :folder
> end
>
> class Folder < File
>         has n, :files, 'File',
>         :parent_key => [ :id ],
>         :child_key  => [ :folder_id ]
> #            has n, :files # not working as well
> end

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to