Migrate from Virtus to ActiveModel::Attributes (and get rid of Rectify::Form)#8669
Conversation
…emodel-attributes-forms
Fix several bugs in different form cases used all over the application related to both, the top-level attributes as well as nested attributes.
|
Can we merge this one @ahukkanen? Or is there anything else that you want to add to this PR? |
|
@andreslucena On my part it's ready. @alecslupu Raised some concerns regarding compatibility with 3rd party modules. I thought I'd still test those two modules he mentioned. I'm not expecting zero changes in these but I would expect most of the things to work fine without changes. Specs will likely need some updates, though. |
|
I have tested both NavbarLinks and Decidim Awesome modules with the Here's my findings: NavbarLinksBranch No problems identified. No changes done. All other specs pass except this one: This failing spec is not related to the Decidim AwesomeBranch Working fine:
Not working without changes:
After the above fix, all configuration forms work normally in the admin panel. All other non-system specs pass after this change except for the following specs:
I believe most of the system specs failures are caused by the missing assets (or broken front-end), as the module has not yet been updated to be compatible with Webpacker. And the uploader specs are failing because ActiveStorage is not fully updated (as far as I understood). It would make much more sense to test these after the module has been upgraded to 0.25 or 0.26. Further notesI am no expert in either of these modules, these were just quick tests within the UI and by running the specs. |
Addressed here ... pending @armandfardeau 's input : OpenSourcePolitics/decidim-module-navbar_links#23 |
🎩 What? Why?
The basic idea of this PR is to refactor the Virtus models (such as all instances of
Rectify::Form) in the core to the new ActiveModel::Attributes based solution as discussed at #7234. The reason for this is the discontinuation of Virtus.This provides a compatibility layer that preserves backwards compatibility as long as possible with the Rectify::Forms API requiring little to no changes in the existing Form classes. ActiveModel::Attributes works a bit differently than Rectify::Form (e.g. no nested Forms or attributes), so we need this layer to keep functionality as-is without any major changes.
📌 Related Issues
Link your PR to an issue
Testing
Run the specs and test the application with this implementation.
📋 Checklist
docs/.