has and belongs to many - Rails - deleting a single record in a intersection table habtm -


मेरे पास एक habtm संबंध है (असाइनमेंट & lt; असाइनमेंट_candidates> उम्मीदवारों)

मैं सक्षम होना चाहता हूँ एक असाइनमेंट से एक उम्मीदवार को हटा दें यहाँ मेरा कोड है अब तक

  @assignment = Assignment.find (: पहले,: joins = & gt;: उम्मीदवारों, चुनें = & gt; "assignments_candidates। *",: Conditions = & gt; ["Assignments_candidates.candidate_id =? और assignments_candidates.assignment_id =?", पैरामीटर [: उम्मीदवार_आईडी], पैरामीटर [: असाइनमेंट_आईड]]) @ असाइनमेंट। डेस्टॉय  

फिलहाल मुझे ये लगता है

किसी भी विचार? ऑब्जेक्ट को प्रतिच्छेदन तालिका में रिकार्ड नहीं है?

धन्यवाद, एलेक्स

यहां बताया गया है कि मैं इसे भविष्य के संदर्भ के लिए कैसे किया था।

  असाइनमेंट = असाइनमेंट.फंड (पैरामोज [: असाइनमेंट_आईडी]) उम्मीदवार = असाइनमेंट.संदिग्ध। पता (पराम [: उम्मीदवार_आईडी]) असाइनमेंट.candidates.delete (उम्मीदवार)   

Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -