Skip to content

Missing Presence Validation with Polymorphic Type Column #163

@Numie

Description

@Numie

I have a polymorphic association like:

belongs_to :documentable, polymorphic: true

There are not_null db constraints on the related documentable_id and documentable_type columns. When I run active_record_doctor, I get the following error:

add a `presence` validator to Document.documentable_type - it's NOT NULL but lacks a validator

I don't think an error should be raised since ActiveRecord already requires both the type and id columns from the single belongs_to association.

Metadata

Metadata

Assignees

No one assigned

    Labels

    false positiveAn error is reported when it shouldn't

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions