diff --git a/lib/amazing_print/ext/active_record.rb b/lib/amazing_print/ext/active_record.rb index 082a187..67762b5 100644 --- a/lib/amazing_print/ext/active_record.rb +++ b/lib/amazing_print/ext/active_record.rb @@ -22,9 +22,9 @@ def cast_with_active_record(object, type) cast = :active_record_instance elsif object.is_a?(::ActiveModel::Errors) cast = :active_model_error - elsif object.is_a?(Class) && object.ancestors.include?(::ActiveRecord::Base) + elsif object.is_a?(Class) && object <= ::ActiveRecord::Base cast = :active_record_class - elsif type == :activerecord_relation || object.class.ancestors.include?(::ActiveRecord::Relation) + elsif type == :activerecord_relation || object.is_a?(::ActiveRecord::Relation) cast = :array end cast