has_log plugin
Posted in coding projects on December 27th, 2008 by irv – Be the first to commentToday I uploaded my first public open source code, the has_log plugin. This is a Ruby on Rails plugin that allows events that take place in one model to automatically (or on demand) be logged to another model. Arbitrary text can be inserted, as well as extra data fields. This makes it possible to log when a product is purchased, or when its price is updated, or even when two people become friends (though that one is slightly more complicated).
I wrote this plug in only after searching for similar ones and finding nothing that was this simple and this well suited for multiple tasks.
As is always the case with any programming project, development is not done. Really, the plug in is now in beta. New features will be added after I have a chance to deploy it in one of the several projects I think I can use it for.
The code and such documentation as there is can be found on github at http://github.com/irving/has_log/tree/master
I’m happy to be putting something out there like this. Who knows? Maybe it will even be useful …
UPDATE 2/4/2009
Pushed a major update that now has support for polymorphic event tables. IOW, the model events are logged to can be associated with multiple other models. Many objects, each with its own unique events, logging to one table. It’s a beautiful thing.
LinkedIn
Technorati Favorites