
Building a Rails Engine #7 — The Orchestrator: Coordinating the Workflow
The Orchestrator: Coordinating the Import Workflow How to coordinate parsing, validation, and persistence through a single class that manages state transitions, handles errors per-record, and integrates with ActiveJob. Context This is part 7 of the series where we build DataPorter , a mountable Rails engine for data import workflows. In part 6, we built the DataImport model to track import state and the Source layer to parse CSV files into mapped hashes. We now have all the individual pieces: targets describe imports, sources parse files, the RecordValidator checks column constraints, and DataImport tracks state. But nothing ties them together. In this article, we build the Orchestrator -- the class that coordinates the full parse-then-import workflow. The problem Without an orchestration layer, the import workflow ends up as 80 lines of procedural code in a controller action: def import import_record . update! ( status: :parsing ) source = DataPorter :: Sources :: Csv . new ( import_r
Continue reading on Dev.to Tutorial
Opens in a new tab


