Hi Eric, I'm running into the same problem. Could you provide a little more detail on your workaround? Thanks,<br><br>Brian<br><br><div><span class="gmail_quote">On 12/31/05, <b class="gmail_sendername">Eric Soderberg</b> &lt;
<a href="mailto:soderic@earthlink.net">soderic@earthlink.net</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I am having a problem with two models that each have a HABTM
<br>relationship to the other. For example:<br><br>CREATE TABLE people (id INT, name TEXT);<br>CREATE TABLE teams (id INT, name TEXT);<br>CREATE TABLE people_teams (person_id INT, team_id INT);<br><br>The person model has:
<br><br>has_and_belongs_to_many :teams<br><br>And the team model has:<br><br>has_and_belongs_to_many :people<br><br>The trouble comes when trying to destroy something, I end up with a<br>recursive stack sequence that looks something like:
<br><br>(eval):7:in `destroy_without_habtm_shim_for_teams'<br>(eval):9:in `destroy_without_habtm_shim_for_teams'<br>(eval):9:in `destroy_without_callbacks'<br>...<br><br>This appears to be due to something in associations.rb
 where the<br>association array is cleared as part of destroying the record. What<br>appears to be happening is that when person.rb is loaded, its HABTM<br>causes team.rb to be loaded which ends up reloading person.rb? I've
<br>added some instrumentation that shows that the<br>destroy_without_habtm_shim_for_teams method ends up being added twice.<br>This causes recursion when the record is destroyed. I've worked around<br>this by embedding this method aliasing inside an &quot;unless
<br>method_defined?()&quot; to prevent the recursive situation. However, I'm<br>suspecting that I'm missing something else obvious.<br><br>I am using activerecord 1.13.2 and rails 1.0.0.<br><br>--<br>Posted via <a href="http://www.ruby-forum.com/">
http://www.ruby-forum.com/</a>.<br>_______________________________________________<br>Rails mailing list<br><a href="mailto:Rails@lists.rubyonrails.org">Rails@lists.rubyonrails.org</a><br><a href="http://lists.rubyonrails.org/mailman/listinfo/rails">
http://lists.rubyonrails.org/mailman/listinfo/rails</a><br></blockquote></div><br>