aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/comment.rb4
-rw-r--r--activerecord/test/models/post.rb2
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb
index d44befbfd2..bf0162d09b 100644
--- a/activerecord/test/models/comment.rb
+++ b/activerecord/test/models/comment.rb
@@ -43,8 +43,8 @@ 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 \ No newline at end of file
+end
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index 4ee67a4bb3..5f01ab0a82 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -212,7 +212,7 @@ end
class PostThatLoadsCommentsInAnAfterSaveHook < ActiveRecord::Base
self.table_name = 'posts'
has_many :comments, class_name: "CommentThatAutomaticallyAltersPostBody", foreign_key: :post_id
-
+
after_save do |post|
post.comments.load
end