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> <<a href="mailto:soderic@earthlink.net">soderic@earthlink.net</a>> 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>
# Don't use a before_destroy callback since users'<br>before_destroy<br> # callbacks will be executed after the association is wiped out.<br> old_method =<br>"destroy_without_habtm_shim_for_#{association_name}"
<br> unless method_defined?(old_method) # !!!<br> class_eval <<-end_eval<br> alias_method :#{old_method}, :destroy_without_callbacks<br> def destroy_without_callbacks<br> #{association_name}.clear
<br> #{old_method}<br> end<br> end_eval<br> 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>> Hi Eric, I'm running into the same problem. Could you provide a little<br>> more<br>> detail on your workaround? Thanks,<br>
><br>> 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>