Hello Sean,
Sean Schulte wrote:
>I have a database, written in Postgresql, that makes extensive use of
>dynamic SQL. Many of the most important tables in the database are
>generated dynamically during runtime; thus I won''t know their names
>while writing the front-end (hopefully in Rails). My question follows:
>what is Rails'' ability to handle this type of database design? Can
I
>access tables whose names are dynamically generated, and if so, how?
>Is it possible to just write a "template" model and controller for
>each class of table, and use these templates to build models and
>controllers that will run each table?
>
>
Due to the dynamic nature of Ruby this should not be a problem. The fact
that you do not know
the names of the tables you create during runtime in advance, could be
handled by dynamic evaluation,
or even easier by just setting the table name of the specific model(s).
Writing up a template controllers and models (from which your real
controllers/models inherit) should
be pretty straight-forward.
To give precise examples, you should give us more details, though.
>I know this isn''t exactly the "Rails Way," but the
database is written
>and is enterprise-class and designed to be as powerful as possible.
>Can Rails handle this kind of database?
>
>
IMO this is the "Rails Way". Rails has just as much "magic"
as your
application has, so it should be a good fit :)
Kind regards,
Dennis Oelkers