Skip to content
Browse files

Delete data when you delete record.

  • Loading branch information...
1 parent 0f8f90d commit 5ddffaaf53cff5a6216d18edd132a7d934806cc9 @iHiD committed Feb 24, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/super_sti/hook.rb
View
2 lib/super_sti/hook.rb
@@ -26,7 +26,7 @@ def has_extra_data(options = {}, &block)
self.const_set "Data", klass
# Add a reference to a data object that gets created when this is created
- has_one :data, :class_name => "#{self.name}::Data", :foreign_key => options[:foreign_key], :readonly => false, :autosave => true
+ has_one :data, :class_name => "#{self.name}::Data", :foreign_key => options[:foreign_key], :readonly => false, :autosave => true, :dependant => :destroy
before_create :get_data
# A helper method which gets the existing data or builds a new object

0 comments on commit 5ddffaa

Please sign in to comment.
Something went wrong with that request. Please try again.