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%'") }