From 2213067545491c9c2b19ece584d02d3c10846a7f Mon Sep 17 00:00:00 2001 From: Julian Rubisch Date: Fri, 12 May 2023 11:55:18 +0200 Subject: [PATCH] fix: Fix nil scopes in method_missing and respond_to_missing? --- lib/active_hash/relation.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/active_hash/relation.rb b/lib/active_hash/relation.rb index b41581d1..6e513e29 100644 --- a/lib/active_hash/relation.rb +++ b/lib/active_hash/relation.rb @@ -164,13 +164,13 @@ def to_ary end def method_missing(method_name, *args) - return super unless klass.scopes.key?(method_name) + return super unless klass.scopes&.key?(method_name) instance_exec(*args, &klass.scopes[method_name]) end def respond_to_missing?(method_name, include_private = false) - klass.scopes.key?(method_name) || super + klass.scopes&.key?(method_name) || super end private