Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #6566 (new enhancement)

Opened 3 years ago

Last modified 11 months ago

[PATCH] Class-table inheritance for ActiveRecord

Reported by: ashley_moran Assigned to: David
Priority: normal Milestone: 2.x
Component: ActiveRecord Version:
Severity: normal Keywords:
Cc: johan.walles@gmail.com

Description

I've been working on this for about a month now. It's a partial implementation of CTI. I've written a description of it here: Class-table inheritance in ActiveRecord

Attachments

activerecord_cti.patch (101.4 kB) - added by ashley_moran on 11/07/06 14:49:52.

Change History

11/07/06 14:49:52 changed by ashley_moran

  • attachment activerecord_cti.patch added.

07/23/07 09:37:43 changed by donv

Anything happening with this?

07/23/07 10:15:01 changed by ashley_moran

Sadly I have not had time to work on this. I've been way too busy at work so had to resort to STI. I've not been following the ActiveRecord code but I know from a post on our blog that the patch no longer works. Not sure how much work it would take to get it back up and working - after that it just needs fixing for associations.

Were you interested in working on it donv?

07/23/07 10:44:52 changed by donv

Yes, I would be interrested in working on this. I have 27 years of experience coding, 3 of them with ruby, and 2 of them with Rails. I am mostly interested in getting my own cases to work, but can contribute to a complete solution if properly motivated :)

I have been using a simple ClTI implementation published at

http://wiki.rubyonrails.com/rails/pages/ClassTableInheritanceInRails

which is OK, and could be developed further. It is only 85 lines (no tests), and is installed as one required file, and even supports associations. You may want to look at it and include a reference link from your page to that page.

I like your implementation better since it has simpler usage and avoids the 'type' column. Also your test suite gives confidence.

Do you think it will ever be included in Rails Core? Otherwise it should be packaged as a gem or plugin.

I am currently using EdgeRails revision 6747 on the project I am using ClTI with. I assume this will cause trouble?

Is your code in any available repository? Maybe RubyForge?

07/23/07 10:59:31 changed by ashley_moran

Cool I was hoping someone would take it over.

I've met the guy that wrote that patch although I hadn't actually seen that code before. (When I get round to cleaning up the blog I will link to it.) He told me he didn't end up using it much because he didn't have time to support issues other developers had with it. That's one of the big problems implementing CTI, I found - making it seamless in every situation is quite tough. My version gets right into the core loading code which is why the patch is so much longer.

I would like to think this would make it into core at some time. CTI is a killer feature for any ORM library IMHO. You will not be able to apply the patch immediately to a recent edge rails - you are best checking out the revision the patch applies to and updating, and seeing where it breaks.

The code is not in a repository, only here. Since it is a patch against the ActiveRecord code there is no real code to move into a repository. If it is possible to make this work as a plugin that would be great, but since it hacks so much of the core code it might not be easy.

WDYT?

07/23/07 11:22:14 changed by donv

What revision does the patch apply to?

Leading the project would be to much for me, if that is what you meant by "take it over". Using, testing, and contributing code is what I am looking for :)

I am sure many others would like to contribute to this project, given the chance.

07/23/07 12:51:20 changed by ashley_moran

Can't remember what revision it applies to - check the patch file, it's somewhere in the header

I never thought of this as a "project", more of a "hack" or a "patch". To do this collaboratively, we would ideally need a branch in the rails repository, although I guess it could be done by importing into a new repository hosted elsewhere.

Any ideas how best to ressurect this? I spent a solid month on it, so it would be nice to think it won't go to waste.

08/10/08 19:01:41 changed by walles

  • cc set to johan.walles@gmail.com.