Skip to content

Map enums using array to the correct column type #52604

@rafaelfranca

Description

@rafaelfranca

Previously enums without keywords were always mapped to integers and indexed by position, now it is converted based on the column type, it works for strings and database enums as well.

# Before enum status: { proposed: "proposed", written: "written", published: "published" } # After enum status: [:proposed, :written, :published]

We can't connect to the database when evaluating the enum call, so we would need to delay the database type inflection possibly to the first usage of the enum.

Related to #51124
Related to #47278
Related to #43085

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions