p 231, Custom SQL Options seems to have stopped short/gone astray.
Reported by Rick DeNatale | December 23rd, 2007 @ 02:18 AM | in Second Edition
At the top of the page code from active_record/associations/has_and_belongs_to_many_association.rb is given which seems to indicate that the :delete_sql option should be used to ensure that the relationship is properly deleted, however this never is used in the final code for the BillingCode class just below.
Comments and changes to this ticket
-

-
Sean August 22nd, 2008 @ 02:05 AM
- → Title changed from p 231, Custom SQL Options seems to have stopped short/gone astray. to For those who don't want to wait for 2e...
- → Tag changed from to chapter7
class BillingCode < ActiveRecord::Base has_and_belongs_to_many :related, :join_table => 'related_billing_codes', :foreign_key => 'first_billing_code_id', :association_foreign_key = 'second_billing_code_id', :class_name => 'BillingCode', :insert_sql => 'INSERT INTO related_billing_codes (`first_billing_code_id`, `second_billing_code_id`) VALUES (#{id}, #{record.id}), (#{record.id}, #{id})', :delete_sql => 'DELETE FROM related_billing_codes WHERE (`first_billing_code_id` = #{id} AND `second_billing_code_id` = #{record.id}) OR (`first_billing_code_id` = #{record.id} AND `second_billing_code_id` = #{id})' end -
Sean August 22nd, 2008 @ 02:06 AM
- → Title changed from For those who don't want to wait for 2e... to p 231, Custom SQL Options seems to have stopped short/gone astray.
Sorry, mistakenly changed title of the ticket
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
