From c6e10b0f600a56e962ff7d1614c50fca20630379 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 7 Jan 2011 19:12:37 +0000 Subject: has_one should always remove the old record (properly), even if not saving the new record, so we don't get the database into a pickle --- activerecord/test/models/pirate.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/test/models/pirate.rb') diff --git a/activerecord/test/models/pirate.rb b/activerecord/test/models/pirate.rb index f2c45053e7..b0490f754e 100644 --- a/activerecord/test/models/pirate.rb +++ b/activerecord/test/models/pirate.rb @@ -78,3 +78,7 @@ class Pirate < ActiveRecord::Base ship_log << "#{callback}_#{record.class.name.downcase}_#{record.id || ''}" end end + +class DestructivePirate < Pirate + has_one :dependent_ship, :class_name => 'Ship', :foreign_key => :pirate_id, :dependent => :destroy +end -- cgit v1.2.3