repair_tickets and rp_parts are HABTM.
If I do:
repair_ticket1.rp_parts
=> [#<RpPart id: 1, ...">, #<RpPart id: 1,...">, #<RpPart ...">]
I only want to delete one of those RpPart id:1, and not both of them. Is it possible? How can I do that?
repair_tickets and rp_parts are HABTM.
If I do:
repair_ticket1.rp_parts
=> [#<RpPart id: 1, ...">, #<RpPart id: 1,...">, #<RpPart ...">]
I only want to delete one of those RpPart id:1, and not both of them. Is it possible? How can I do that?
If you want to remove duplicates from your array you do
repair_ticket1.rp_parts.uniq!