Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty value for belongs_to field #2090

Closed
mbajur opened this issue Oct 16, 2014 · 1 comment
Closed

Empty value for belongs_to field #2090

mbajur opened this issue Oct 16, 2014 · 1 comment
Milestone

Comments

@mbajur
Copy link

mbajur commented Oct 16, 2014

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!

@mshibuya
Copy link
Member

mshibuya commented Oct 2, 2021

Actually this can be achieved by clearing out the search widget by repeatedly pressing the backspace key.
But I agree that it would be better to have a mouse-friendly way, like showing a ❌ button which clears the current selection.

@mshibuya mshibuya added this to the 3.0.0 milestone Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants