Closed ludalex closed 7 years ago
That's how Martin fowler defined it. Bill Karwin sugest that model also. The polymorphic design is not so bad, but mix data with metadata. If we were using the same id on the child tables as in the parent table, will allow us to create referential integrity over all relations.
Unfortunately I'm not in a position to work on a fork to accomplish this - but I would really need it for a project that involves working on existing a schema structured with inheritance as described above.
Would it be trivial to add this as an option @hzamani? I think many people will benefit.
I think this will be quite a major change but it should be doable in theory in a fork.
Closing this for now, if anyone is interested to work on this please fork https://github.com/krautcomputing/active_record-acts_as
I found myself to work with a legacy schema where table inheritance is done by referencing the two tables with the "id" column, where the inheriting tables have "id" which is a foreign key to the inherited "id". No "actable_id" and "actable_type" is just "type":
This kind of class table inheritance is exactly the same used by the
sequel
plugin to do that, which in fact works great with my schema... but I would really like to use AR instead. Main reason is to use it in combination withjsonapi-resources
.I was wondering if this was easily doable to offer as an option or it would completely break your design.