John Smith wrote:> I have this code in rp_parts controlled in def destroy:
>
> @repair_ticket.rp_parts.delete(@rp_part)
>
> 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?
Consulting the API, I found that:
.delete:
Deletes the record with the given id without instantiating an object
first. If an array of ids is provided, all of them are deleted.
What if I only want to delete the first one?
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---