diff options
Diffstat (limited to 'activerecord/test/models/reference.rb')
-rw-r--r-- | activerecord/test/models/reference.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/models/reference.rb b/activerecord/test/models/reference.rb index 87d4a71963..e33a0f2acc 100644 --- a/activerecord/test/models/reference.rb +++ b/activerecord/test/models/reference.rb @@ -3,6 +3,18 @@ class Reference < ActiveRecord::Base belongs_to :job has_many :agents_posts_authors, :through => :person + + class << self + attr_accessor :make_comments + end + + before_destroy :make_comments + + def make_comments + if self.class.make_comments + person.update_attributes :comments => "Reference destroyed" + end + end end class BadReference < ActiveRecord::Base |