On 5 Nov 2008, at 23:01, TomRossi7 wrote:

>
> Lets say you have a relationship like post has and belongs to many
> categories.  If I were to do something like the following:
>
> category << post
> category << post
> category << post
>
> I've basically assigned the post to the category three times.  I'm
> noticing that in my join table there are now three join records?
> Shouldn't it only have one?

If that's what you require, set the :uniq option on the association  
(and create a unique index on that table to enforce that if you are so  
enclined)

Fred
>
>
> This causes problems when you do category.posts and you get the same
> post three times.  I'm just wondering if I am missing something here?
>
> Thanks,
> Tom
> >


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