Closed fatkodima closed 2 months ago
@fatkodima, I don't believe this PR is correct. I think it's perfectly valid to instantiate the base class of an STI hierarchy: in this case type
will be nil
. A subclass of the STI base class will have its name stored in type
.
A proper fix for the problem would be to skip the check on the type
column.
Agreed, fixed.
Perfect! Thank you, @fatkodima.
When the STI-like parent model has no children, all the
next
branches in thedetect
method pass (specificallynext if !concrete_models.all? { |model| non_null_needed?(model, column) }
) andMissingNonNullConstraint
erroneously adds offenses for the column. See a test case for the example.