Skip to content

Commit

Permalink
fix: Fix nil scopes in method_missing and respond_to_missing?
Browse files Browse the repository at this point in the history
  • Loading branch information
julianrubisch committed May 12, 2023
1 parent 7a07bcc commit 2213067
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/active_hash/relation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2213067

Please sign in to comment.