diff options
author | Matt Jones <al2o3cr@gmail.com> | 2009-11-07 14:00:54 -0500 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2009-11-10 18:41:37 +1300 |
commit | d625312fe11bbf53e285a0efd570249f0bf91fd1 (patch) | |
tree | 9ded25037ea44d55e11abb4e84a174694f99a350 /activerecord/lib | |
parent | 11e798ae0f2f46498811282756c9d21df3d4b523 (diff) | |
download | rails-d625312fe11bbf53e285a0efd570249f0bf91fd1.tar.gz rails-d625312fe11bbf53e285a0efd570249f0bf91fd1.tar.bz2 rails-d625312fe11bbf53e285a0efd570249f0bf91fd1.zip |
delete correct records for a has_many with :primary_key and :dependent => :delete_all
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 03c8d4b3ed..3a5f3ed030 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1480,7 +1480,7 @@ module ActiveRecord if reflection.options.include?(:dependent) # Add polymorphic type if the :as option is present dependent_conditions = [] - dependent_conditions << "#{reflection.primary_key_name} = \#{record.quoted_id}" + dependent_conditions << "#{reflection.primary_key_name} = \#{record.#{reflection.name}.send(:owner_quoted_id)}" dependent_conditions << "#{reflection.options[:as]}_type = '#{base_class.name}'" if reflection.options[:as] dependent_conditions << sanitize_sql(reflection.options[:conditions], reflection.quoted_table_name) if reflection.options[:conditions] dependent_conditions << extra_conditions if extra_conditions |