dino d. wrote:
> a.bs << b
> a.bs << b
> a.bs << b
> 
> this creates 3 records in the join table.
> 
> Is there any way for me to remove only one of these?  I can only seem
> to remove all of them.

b = B.first # Find the b you want to remove association to.
a.bs.delete(b)

>From has_and_belongs_to_many doc:

collection.delete(object, …)
Removes one or more objects from the collection by removing their 
associations from the join table.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to