Skip to content

Instantly share code, notes, and snippets.

@ohnotnow
Last active August 10, 2016 11:51
Show Gist options
  • Save ohnotnow/ef81d8b4c9c7787a2eaa3450e7d8a126 to your computer and use it in GitHub Desktop.
Save ohnotnow/ef81d8b4c9c7787a2eaa3450e7d8a126 to your computer and use it in GitHub Desktop.
Versioning forms/models
For instance, say I have an 'annual review' form for people. Last year
they had to fill out training courses attended, this year they don't.
Next year the form changes completely but is still called an 'annual
review' as far as the business is concerned. The forms can change
pretty much any time - not just on a nice annual cycle (naturally).
There are also process/logic changes like one year a review has to be
signed off by the line manager. Next year it has to be also signed off
by their unit head. The year after there is an arbitration process
introduced so if the person appeals the decision of $whoever was supposed
to sign it off, which in turn changes the year after...
So a user will want to see a list of all annual reviews and expect to
be able to click it and see the right form & data for that particular
review irrespective of when it was made.
My current (horrible) system creates models & views like
'AnnualReviewV20160825' views/annual_review/2016_08_25/show.blade.php
which is pretty horrific. It's like conditional spaghetti :-/
I keep seeing a better solution out of the corner of my eye, then it
slides out of view the moment I turn my head...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment