
Versions VS Approvals
Today I encountered a tricky problem in a seemingly simple "one record is not showing up in #index" bugfix task. The problem stems from this data situation: Task . pluck ( :project_version_id , :is_actual ) #=> [ [ 1 , true ], [ nil , true ] ] Both versioned and non-versioned records can be :actual, can this be right? Thinking about it, I came to the realization that working with versioned data requires clear answers to these questions: Are 'draft' data ever persisted in a sort of 'lobby'? What is more important - accessing possible draft data or possible latest approved/actual version? What operation(s) result in new version(s)? Depending on the answers, you can get one of these two systems: The key difference for developers is the meaning and importance of unversioned data. In version case, regular data are the actual and special access is needed for historic version data. Whereas in approval pattern it's the opposite - unversioned data is less important, since it's not yet 'approved
Continue reading on Dev.to
Opens in a new tab



