railsadminteam / rails_admin

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data
MIT License
7.87k stars 2.25k forks source link

Reset polymorphic id upon type change #3630

Closed KMinChrist closed 4 days ago

KMinChrist commented 1 year ago

Hi, thank you for your attention. Currently, for polymorphic association fields, the id persists after type is changed, which may be unclear to users and cause a bug if the id is selected before type. With this change, the id field can be reset each time the type field changes. I hope you can approve this merge request. Thank you!

mshibuya commented 1 year ago

Thank you for the PR. The fix makes sense, could you add a test case to verify this? https://github.com/railsadminteam/rails_admin/blob/master/spec/integration/fields/polymorphic_assosiation_spec.rb will be the best place to work.

mshibuya commented 4 days ago

Let me write a test. Thank you.