The workflow
Review Before It Is Done
The better workflow came down to what a job is allowed to do next. A tax return is started, can be put on hold or have an extension filed, and goes to review, where an admin completes it or sends it back. Only then is it done.
An admin can complete a return early, and a bookkeeping job without financials skips review, but what you can press always depends on where the job is.
With workflows this branching, and a firm handling other people’s tax and financial records, the rules could not live in people’s heads or in scattered if statements. Each kind of job is a state machine on its Active Record model, written with the AASM library, so the steps and the moves between them are declared once and enforced in one place. Pundit then decides who may make each move, so the buttons on screen come from the state machine and the permissions together. The idea is the one in my open source active_admin-state_machine gem, which builds ActiveAdmin’s action buttons from a resource’s state machine. This app has its own small version of it, written for AASM.
Step through one tax return here. It is demo data, and the buttons in each state are the app’s own.