Michael Latta: Building a Composite Model in ActiveRecord
Posted by Annalisa Afeltra in
Ruby on Rails -
comments are closed
Michael that talks about his experience in creating models that inherit from an emulation of ActiveRecord.
It could be an interesting session. Michael uses ActiveScaffold to create an application for a demo, the difference is that he does not use use ActiveRecord to managge the models ma emulates ActiveRecord with a ad-hoc class that he virtualizes.
The approach utilises to implement similar classes is to “find a bug and solve it” repetitively, that in Michael’s opinion is like making a TDD (test driven development)
Clearly emulating ActiveRecord is complicated, for example to recreate the update function, manage the association and keep the functionality of extensions and macros.
(the discussion now moves towards technical detail necessary to perform this)
Also to support the counting was not an easy task Michael confirms (just as the find method).
Once the VirtualModel is compatible with ActiveScaffold you need to make it in a way that this accepts the creation of a new instance, also here the use of the procedure is the same; continuously finding errors and fixing them.
I find the idea that is shown by Michael also not his own (at least from my point of view), no practical value has he been able to be show in detail of a library such as ActiveRecord.
Annalisa

