Skip to content

Empty value for belongs_to field #2090

@mbajur

Description

@mbajur

Hello!
I'm trying to modify model's form for rails_admin but i'm not able to implement not find any tutorial on one simple thing. Can i somehow add an empty option for belongs_to field?

Let's say i have two models - Shop and User. User belongs_to Shop. If i will use field :shop in User rails_admin config, it gives me a widget with all available shops but i'm not able to not select any of them. There always needs to be one selected.

Thanks in advance for any clues!

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions