How do I remove a single HABTM associated item without deleting the item itself?
问题 How do you remove a HABTM associated item without deleting the item itself? For example, say I have 3 Students that are in a Science class together. How do I remove the Science objects from the StudentsClasses table without deleting the actual Science reference? I'm guessing that Student.Classes.first.delete isn't a good idea. I'm using JavaScript with drag-and-drop for adding and removing, not check boxes. Any thoughts? 回答1: I tend to use has_many :through, but have you tried student.classes