Parent instances can now either point at a certain point in time or track the current time (and detail). The current? method determines which of these states the instance is in. The current! method forces the instance to track the current time and resets the detail to the current detail should it be pointing at a previous one. The on= method now forces the instance to point at a certain point in time (and still resets the detail to the detail at that point in time should it be pointing at another one).
Updating the columns on the parent ensures that all ActiveRecord functionality (e.g. dirty attribute tracking) works as expected. It will also allow us in future to use the values on the parent as the values effective as of the current time.
Updating multi-parameter attributes (e.g. dates on a form) currently doesn't work without the tracked attributes also existing on the parent table (see TODO). These columns should never get updated however as the getters and setters are overridden.
Alter test fixtures to include tracked integer, string and datetime datatypes. Also add a column which can later be used to test belongs to associations but this isn't intended to be working yet. These changes were necessary as currently updating fails when multiparameter attributes (e.g. datetime columns) are updated. This is due to the parent column not having the column in its table and ActiveRecord relying on this fact to perform the update.
Rather than using parent_id on the dated detail model to refer to the parent model use the conventional column name (e.g. super_hero_id)
Added named scope to dated detail to return the record effective at a given timestamp. Altered dated_detail method to return detail effective at the time returned by the on method.
The point in time at which the parent object fetches its details can now be set and retrieved.
When the parent is saved and changes have been made to tracked attributes the old and new dated detail record's timestamps are correctly updated such that one follows the other.
A new detail record is now created whenever changes to tracked attributes are saved in addition to initial creation of parent record