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/lib/active_record/reflection.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 1312bf6f91..eefda2b8f4 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -477,7 +477,7 @@ module ActiveRecord def check_preloadable! return unless scope - if scope.arity > 0 + unless scope.arity == 0 raise ArgumentError, <<-MSG.squish The association scope '#{name}' is instance dependent (the scope block takes an argument). Preloading instance dependent scopes is -- cgit v1.2.3