AR: Model on several tables

Hi,

Is it possible to have a Model where columns are not in one table, but
two tables?

Jean-Etienne

Not that I’m aware of. You may be able to use a view in the database
to emulate one table… worth a shot. Why do you need to do this?

-Jonathan.

Jonathan V. wrote:

Not that I’m aware of. You may be able to use a view in the database
to emulate one table… worth a shot. Why do you need to do this?

-Jonathan.

I have a a lot of models “almost” the same, and was thinking to go for
Class Table Inheritance.
I have several remarks about STI:

  1. Locking: it will lock a model when somebody updates another one…
  2. I do not see how to use reflection to get model properties. I
    probably need to maintain a table to know what are the properties for
    all models. It doesn’t look right to me.
  3. ActiveRecord updates all properties all the time, so UPDATE will be
    huge.

Last solution would to go for Concrete Table Inheritance, but again, I
need to hash the identifier generation, keep a table with oids and class
to resolve object types, … I seems to me too huge infrastructure to
build for what I need (not so many documents).

Any advice?

Anybody to give her/his experience on Concrete Table Inheritance ?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs