I think one of the delete methods is what you're after, see http://bit.ly/co4Mce

e.g.,

p = Project.first(:code => 'AAC')
w = p.wuser.first(:login => 'mcpl')

p.wuser.delete(w)

Seems from the source code delete_if would be a shorter way to do it
(the docs above are a tad ambiguous on _if's intended result,) but
I've not used it myself.


Good luck,
Yuri


On Jun 21, 6:15 am, wea_gruena <[email protected]> wrote:
> Sorry for this newbie question ;-)
> But I didn't found a good solution in the mailings.
>
> My problem:
> I can't remove existing associations / relations between classes.
>
> <code>
> class Project
>         #~ #PDMS projects
>         include DataMapper::Resource
>         property :code, String, :key => true, :length => 3, :required => true
>         #...
>         has n, :wuser, :through => Resource
> end
>
> class Wuser
>         #~ #Windows user (login name)
>         include DataMapper::Resource
>         property :login, String, :key => true, :required => true
>         #...
>         has n, :project, :through => Resource
> end
> </code>
>
> If I try to delete a relationship with:
>
> <code>
> p = Project.first(:code => 'AAC')
> p.wuser.first(:login => 'mcpl').destroy
> </code>
>
> My ressource (Wuser 'mcpl') will be deleted.
>
> Where is my mistake or how can I delete one association ?
>
> Thanks before for your answers and help !!!

-- 
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