Skip to content

Commit

Permalink
ensure_inheritance condition
Browse files Browse the repository at this point in the history
`subclasses` was added as part of Ruby 3.1
https://ruby-doc.org/core-3.1.0/Class.html#method-i-subclasses

Add a `respond_to?` to `base` to ensure that Ruby 3.0 will continue to
work as expected.

#511 (comment)
  • Loading branch information
davegudge committed Jan 5, 2024
1 parent 9e5ed22 commit 1084490
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/statesman/adapters/active_record_queries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def initialize(**args)
end

def included(base)
ensure_inheritance(base) unless base.subclasses.none?
ensure_inheritance(base) if base.respond_to?(:subclasses) && base.subclasses.any?

query_builder = QueryBuilder.new(base, **@args)

Expand Down

0 comments on commit 1084490

Please sign in to comment.