Has anyone implemented some sort of automatic class to dynamic table
The idea is to have a single table capable of storing various unrelated
classes. Some sort of Extreme polymorphism.
I've used this with other languages. E.g. osproperty in Java. The idea
is the following
In the DB
create table dynamicobjects (
primary key (id, object_type, key_name)
then I could map any instance of any class to it.
def initialize(firstname, lastname, birthdate)
@firstname = firstname
@lastname = lastname
@birthdate = birthdate
would end up being stored as multiple rows one for each instance
property, all indexed with object_type = 'user' and id = @user.id.
I just wonder if this sort of design would be not fitting with the way
rails works. Would that cause particular problems ?
If that sounds OK, and nobody did it before, I am willing to try. Any
hints on what I should try to use from the framework itself ?