Class-table inheritance in ActiveRecord

Hi people

I've just submitted a patch that adds CTI to ActiveRecord. It's not quite done yet - some stuff is untested, and associations (probably) don't work with CTI classes. But you can read and write CTI records with no special syntax (it looks just like STI).

I've posted more details on my company's blog here: http://pdcm.codeweavers.net/2006/11/7/class-table-inheritance-in-activerecord And you can download the patch from the Rails trac: http://dev.rubyonrails.org/ticket/6566

The patch is quite large - it was a lot trickier to make it work than I thought at first because ActiveRecord has a few assumptions that only hold under STI. I've avoided nasty hacks but it still took some voodoo meta-programming to preserve the existing functionality.

Class-table inheritance is one of the big feature we want at my company before we start any big Rails apps. If anyone would like to use it in their own projects don't wait to let me know :slight_smile: I'm hoping I can finish it off in a week or two. It's hard to gauge the demand for CTI because not many people have attempted it so far.

Ashley

very exciting Ashley!

I have a project coming around the bend where this will be very useful.

thank you. Jodi

Cool. I was hoping it would be useful to other people. There's still a fair bit to do though, but I'm hoping to have it finished completely in 2-3 weeks.

If anyone from the core team is watching, does this look like something that could make it into the ActiveRecord core? The patch is pretty hefty, and there's no way it could be maintained as a plug-in. If so, I could do with discussing the rest of the tests before I do any more work, as it's quite a fundamental change to the way ActiveRecord maps objects to tables.

I can't tell you how much I'd love this to be in 1.2 :slight_smile:

Ashley