Closed fuegas closed 1 month ago
Is there anything stopping this simple fix being merged?
This issue is a big barrier to upgrading to Rails Admin 3.x, as for a long time the "legacy" enums were the only way to do enums in Rails Admin. The wiki implies that ActiveRecord enums are considered a replacement for the legacy enums, but they don't really provide equivalent functionality. ActiveRecord enums are explicitly for mapping values to the database, but the "legacy" Rails Admin enums can/could be used anywhere where you want to provide admins with a list of options to pick from.
cc @mshibuya would be amazing if you could look - I think you were the last person to change this code in https://github.com/railsadminteam/rails_admin/commit/be9a75e504edd9a754157a4ddba590e8a5d14149
Oh sorry, I just didn't have a chance to look at this. Could you add a RSpec test case for this fix?
I've added a test and fixed a similar error in #enum_method
. Since I don't have write access to @fuegas's fork I've opened a new PR with the additions here: #3684
Thank you so much for the PR, but the fix was made as https://github.com/railsadminteam/rails_admin/commit/d62f604cc8d7d1434f7dfe0c5aca3aaf3dc2547b.
Filtering on enum (in list view) gave the following error:
This is because bindings is nil and thus the hash lookup fails. By adding safe navigation we circumvent this error and use the second option namely
abstract_model.model.new
.