aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/comment.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/models/comment.rb')
-rw-r--r--activerecord/test/models/comment.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb
index f82df417ce..bf0162d09b 100644
--- a/activerecord/test/models/comment.rb
+++ b/activerecord/test/models/comment.rb
@@ -40,3 +40,11 @@ end
class VerySpecialComment < Comment
end
+
+class CommentThatAutomaticallyAltersPostBody < Comment
+ belongs_to :post, class_name: "PostThatLoadsCommentsInAnAfterSaveHook", foreign_key: :post_id
+
+ after_save do |comment|
+ comment.post.update_attributes(body: "Automatically altered")
+ end
+end