Are the posts and labels associated through a join table? class Post ... has n, :labelings has n, :labels, :through => :labelings end
label_to_remove = Label.get(id) some_post.labelings.first(:label => label_to_remove).destroy On Mar 11, 12:18 pm, bl <[email protected]> wrote: > I can't find this anywhere. > > Let's say you're making the classic "blog" style app and you have > Posts with labels. Well I know you can do: > > some_post.labels << some_label > some_post.save > > But it seems like you can't do: > > some_label = Label.get(id) > some_post.labels.remove(some_label) > some_post.save > > remove() throws a type error, delete_if doesn't enumerate, etc. > > I must be missing something here. This would seem to be an essential > feature of associations but there's no documentation for it and web > searches turn up almost nothing. -- 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.
