-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Handle nullable foreign key in multiselect #2446
Handle nullable foreign key in multiselect #2446
Conversation
dd4ad2f
to
b86b269
Compare
b86b269
to
c2f12af
Compare
…multiselect Handle nullable foreign key in multiselect
Thanks for your work! 🍺 |
@jibidus @mshibuya it seems that this PR breaks I've got relation: promotion has many user_promotions when I'm opening view to add new promotion, I can add users there, and what happens during this code execution: def foreign_key_nullable?
return if foreign_key.nil? || type != :has_many
klass.columns_hash[association.foreign_key].null
end is that Any idea how to fix it? |
@arnvald Let me have a look. |
@arnvald I didn't manage to reproduce the issue 😩 . |
@jibidus I created a simple application here: https://github.com/arnvald/rails_admin_polymorphic_bug To reproduce:
I'll try to write a spec that'll cover this case, either today or tomorrow. |
@jibidus thanks for fixing the bug! |
How can i configure this manually? i want some has_many fields without those buttons to remove the association. But adding
Does nothing. |
This Pull Request was designed to prevent displaying the |
I made my own custom field for my use case, i don't want the foreign key nullable i wanted that field to not have that remove button on that particular model, so this is what i did: |
has_many
with not nullable foreign may raise exception when user try to remove elements from corresponding association.The aim of this request is to prevent such behavior with disabling
remove
actions from form.