aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYasuo Honda <yasuo.honda@gmail.com>2017-08-22 18:09:56 +0000
committerYasuo Honda <yasuo.honda@gmail.com>2017-08-23 02:14:48 +0000
commitaaaa2dc04a4b52c9183e321d93b01de0740361bd (patch)
tree59bc7e430e3858c21b15dfce612d38ccdaec28c1
parent665ac7cff212d010a3573f85cea895666fbaad15 (diff)
downloadrails-aaaa2dc04a4b52c9183e321d93b01de0740361bd.tar.gz
rails-aaaa2dc04a4b52c9183e321d93b01de0740361bd.tar.bz2
rails-aaaa2dc04a4b52c9183e321d93b01de0740361bd.zip
`counter_cache` requires association class before `attr_readonly`
There were similar pull requests #26370 #27575 fixed by different way by moving `require "models/post"` before `require "models/comment"`
-rw-r--r--activerecord/test/models/comment.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb
index 61c54a77a7..740aa593ac 100644
--- a/activerecord/test/models/comment.rb
+++ b/activerecord/test/models/comment.rb
@@ -1,5 +1,8 @@
# frozen_string_literal: true
+# `counter_cache` requires association class before `attr_readonly`.
+class Post < ActiveRecord::Base; end
+
class Comment < ActiveRecord::Base
scope :limit_by, lambda { |l| limit(l) }
scope :containing_the_letter_e, -> { where("comments.body LIKE '%e%'") }