Month: November 2004

Mapping Tree-like structures to tables

Posted by – 03/11/2004

I’ve been messing with ActiveRecord (from the Ruby on Rails Framework) for some time now, and I must state that I love it. Although I don’t use the full Rails framework (I like to use other kind of approach to render my webpages), the ORM pattern ActiveRecord implements is killer!

Well… for one of my pet projects I needed to map tree-like structures (like one-to-many objects connections) to tables, and I used ActiveRecord as my backend. This is the module that I came up with. It’s still rough and need a lot of polish and documentation, but is a general purpose module for the ActiveRecord. Contributions are welcome.

No error-testing were included. The 0.51 release is a “make it work” release. I wish I could figure out how to make it work with database backends other than MySQL, but my SQL skills have not allowed me to understand REGEXP calls in other backends. I’ve stripped out the unit testing also, since I found those were not “releaseable” tests. They can come in in a future release, who knows.

Happy Hacking.