aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-08-23 11:58:36 +0900
committerGitHub <noreply@github.com>2017-08-23 11:58:36 +0900
commitabe9592beadf8f7146bc531b94aab2992eb5eeb4 (patch)
tree85ddee05d33f0f317fa0aa1fceda92632a9dd353
parent793807375b62ca091f59576642dd5affcf07144c (diff)
parentaaaa2dc04a4b52c9183e321d93b01de0740361bd (diff)
downloadrails-abe9592beadf8f7146bc531b94aab2992eb5eeb4.tar.gz
rails-abe9592beadf8f7146bc531b94aab2992eb5eeb4.tar.bz2
rails-abe9592beadf8f7146bc531b94aab2992eb5eeb4.zip
Merge pull request #30365 from yahonda/require_post_before_comment
`counter_cache` requires association class before `attr_readonly`
-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%'") }