Displaying 1 result from an estimated 1 matches for "value_char".
2006 Nov 02
0
DB: class to multiple rows mapping (aka rails 'osproperty')
...rious 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 (
  id int,
  object_type varchar(255),
  key_name varchar(255),
  value_type int,
  value_int int,
  value_char varchar(255),
  value_longchar text,
  ...
  primary key (id, object_type, key_name)
)
then I could map any instance of any class to it.
E.g.
class User
  def initialize(firstname, lastname, birthdate)
    @firstname = firstname
    @lastname = lastname
    @birthdate = birthdate
  end
end
woul...