Re: dynamically defined ar classes

Steve Bartholomew
Tue, 30 Jan 2007 18:23:05 -0000

I''m not sure I completely understand why you want to do this.  If
it''s
to keep things DRY I would question whether this is a bit of an OTT
optimisation.  The models you specified seem generally unrelated and
as your application grows, you will most likely find that this method
becomes a hindrance rather than beneficial.

I may be wrong of course, but generally separating your models out and
defining them individually is a good plan long term.  If you want
something to get started with, I would suggest looking at Dr Nic''s
Magic Models (http://magicmodels.rubyforge.org/).  This is a plugin
that automatically creates models from the database schema.  Even if
it''s not what you''re looking for, you may pick up a few tips
for what
you''re trying to do by having a look through the source code.

Steve