# aasm gem upgrade plan ###### tags: `nitro` We're on version 4.0.0 of the aasm gem (not Ruby 3 compatible) and the current version as of this spike is 5.5.0. We have relied on some customizations that injected functionality within AASM which do not work with newer versions past 4.0.0. * transition validation * tracking history AASM's has a new way of [Extending AASM](https://github.com/aasm/aasm#extending-aasm) which I assume would be more resilient to changes with future upgrades. I don't believe this is needed to deal with validations, however. I think our transition validations can be replaced with [AASM's guards](https://github.com/aasm/aasm#guards) although maybe we handle exceptions a little differently. But I'm not sure we need to override that so much just switching from using our custom event validations to actual guard instances when we define the events. We already have a lot of code that uses guards now. Affected classes are: - [x] ChangeRequest [HFH-1382](https://nitro.powerhrg.com/runway/backlog_items/HFH-1382) - [x] DownPayment [HFH-1383](https://nitro.powerhrg.com/runway/backlog_items/HFH-1383) - [x] DriverProfile [HFH-1384](https://nitro.powerhrg.com/runway/backlog_items/HFH-1384) - [x] LoanApplication [HFH-1385](https://nitro.powerhrg.com/runway/backlog_items/HFH-1385) - [x] SolarRoofing::Project [HFH-1389](https://nitro.powerhrg.com/runway/backlog_items/HFH-1389) - [x] Payment [HFH-1386](https://nitro.powerhrg.com/runway/backlog_items/HFH-1386) - [x] ProjectPayment [HFH-1387](https://nitro.powerhrg.com/runway/backlog_items/HFH-1387) - [x] Project [HFH-1388](https://nitro.powerhrg.com/runway/backlog_items/HFH-1388) - [x] FinanceProject [HFH-1420](https://nitro.powerhrg.com/runway/backlog_items/HFH-1420) - [x] Remove custom validation logic from AASM [HFH-1414](https://nitro.powerhrg.com/runway/backlog_items/HFH-1414) The only thing that's truly custom seems to be with `track_history` which may be the primary reason to use a custom AASM class. This part would likely need to be associated with a PR with the actual `aasm` gem's update. - [x] Setup custom `aasm` base class to allow for `track_history` [HFH-1390](https://nitro.powerhrg.com/runway/backlog_items/HFH-1390) - [x] Remove customizations for aasm gem in NitroStateMachine [HFH-1391](https://nitro.powerhrg.com/runway/backlog_items/HFH-1391) - [x] Upgrade `aasm` gem