Thanks, Eric, I'll try this out. (Band-aid, perhaps, but if it works...)<br><br>Looks like this: <a href="http://dev.rubyonrails.org/ticket/3175">http://dev.rubyonrails.org/ticket/3175</a> might be the same issue?<br><br>Brian
<br><br><div><span class="gmail_quote">On 1/2/06, <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;">
Brian,<br><br>I changed the implementation of has_and_belongs_to_many() in<br>associations.rb<br>(gems/1.8/gems/activerecord-1.13.2/lib/active_record/associations.rb) to<br>check for the existence of the shim method:<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Don't use a before_destroy callback since users'<br>before_destroy<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# callbacks will be executed after the association is wiped out.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;old_method =<br>&quot;destroy_without_habtm_shim_for_#{association_name}&quot;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unless method_defined?(old_method) # !!!<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;class_eval &lt;&lt;-end_eval<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alias_method :#{old_method}, :destroy_without_callbacks<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def destroy_without_callbacks<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#{association_name}.clear
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#{old_method}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end_eval<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end # !!!<br><br>I added the two lines with '# !!!'.<br><br>This feels more like a band-aid than a fix since I would expect this<br>has_and_belongs_to_many call to not occur twice to begin with. Just
<br>haven't had time track it down further yet.<br><br>Eric<br><br>Brian Green wrote:<br>&gt; Hi Eric, I'm running into the same problem. Could you provide a little<br>&gt; more<br>&gt; detail on your workaround? Thanks,<br>
&gt;<br>&gt; Brian<br><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>