Skip to content

select definitions: Superform expects [value, label], Rails expects [label, value] #71

@nimmolo

Description

@nimmolo

From my comment on #64

An unexpected API gotcha that would require a breaking change to fix:

Superform select expects [value, label] ordering for select options, which is the opposite of Rails' options_for_select [label, value].

This is a real gotcha for refactoring from ERB, it means devs have to manually flip all the arrays.

It would be good to change this API. I can't imagine how to change it without breaking people's existing select implementations, though.

I keep encountering this in my Phlex conversions, and I hope creating an issue here might be a good way to discuss workarounds, or a fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions