On 20 July 2015 at 00:53, Sadaf Noor <em...@sadafnoor.com> wrote:
>
> Hello,
> I am having a little bit problem in deleting duplicate entry of my many to 
> many tables.
>
> In many to many fields delete method is deleting all the occurrence of 
> collection. Say I have (demo example):
>
> class user < ActiveRecord::Base
>   has_and_belongs_to_many :cars
> end
>
> class car < ActiveRecord::Base
>   has_and_belongs_to_many :users
> end
>
> users and cars are many to many relationship, I have defined my users_cars 
> table. Now user can have repetitive car entry as relation. For example:
>
> Car: A,B,C User: U1,U2,U3
>
> U1=[A,B,C,A,A,A,B]

How can a user have the same car multiple times, it doesn't make sense.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvUZ8StTffzrGwemBgTUDzgZwO7o1ofxhvmeR5%3DFC1H6A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to