Skip to content

Commit

Permalink
Merge pull request active-hash#278 from julianrubisch/fix-nil-scopes
Browse files Browse the repository at this point in the history
Fix nil scopes in method_missing and respond_to_missing?
  • Loading branch information
kbrock authored Aug 11, 2023
2 parents 133b47d + 2213067 commit 0774392
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 0774392

Please sign in to comment.