Compound primary keys in your rel table.
On Jul 14, 2005, at 5:12 PM, Josh Knowles wrote:
> What is the approach people are using to ignore duplicate records in
> their habtm relationships? I have seen the :uniq option, but this
> just forces uniquness on the query, it still allows you to add the
> same record to the collection multiple times. What are people doing
> so that the following code won''t result in two rows in your db:
>
> class User < AR
> end
>
> class Group < AR
> habtm :users, :uniq => true
> end.
>
> group1.users << user1
> group1.users << user1
>
> asert_equal 1, group.users.size
>
> Test failed: Expected 1 but was 2
>
>
> Personally I would have expected the :uniq option to enforce this
> behavior but I am obviously missing something.
>
> Josh
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>