From f4fd7d1d20dfbc4389435a8f0f153f7960bb1544 Mon Sep 17 00:00:00 2001 From: Rob Trame Date: Wed, 1 May 2019 13:53:35 -0700 Subject: Make scope arity check consistent (#36134) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Make scope arity check consistent * Add test for arity change [Rob Trame + Rafael Mendonça França] --- activerecord/test/models/author.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/test/models') diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb index 67be59a1fe..b52b643ad7 100644 --- a/activerecord/test/models/author.rb +++ b/activerecord/test/models/author.rb @@ -153,6 +153,7 @@ class Author < ActiveRecord::Base has_many :comments_on_posts_with_default_include, through: :posts_with_default_include, source: :comments has_many :posts_with_signature, ->(record) { where("posts.title LIKE ?", "%by #{record.name.downcase}%") }, class_name: "Post" + has_many :posts_mentioning_author, ->(record = nil) { where("posts.body LIKE ?", "%#{record&.name&.downcase}%") }, class_name: "Post" has_many :posts_with_extension, -> { order(:title) }, class_name: "Post" do def extension_method; end -- cgit v1.2.3