diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-01-07 19:12:37 +0000 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-11 13:45:06 -0800 |
commit | c6e10b0f600a56e962ff7d1614c50fca20630379 (patch) | |
tree | 790c400d45f2c5316aff05475b295990764e80ce /activerecord/test/models | |
parent | 665880c0809b563d3afaeadd073f5d0b6289a42e (diff) | |
download | rails-c6e10b0f600a56e962ff7d1614c50fca20630379.tar.gz rails-c6e10b0f600a56e962ff7d1614c50fca20630379.tar.bz2 rails-c6e10b0f600a56e962ff7d1614c50fca20630379.zip |
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
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/pirate.rb | 4 |
1 files changed, 4 insertions, 0 deletions
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 || '<new>'}" end end + +class DestructivePirate < Pirate + has_one :dependent_ship, :class_name => 'Ship', :foreign_key => :pirate_id, :dependent => :destroy +end |