dynamically defined ar classes

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

So: can this work?

Yeah, but not in the way you have. You can use the 'eval' command to
execute ruby code to create your classes:

['MyNewClass'].each do |klass|
   model_string = "class #{klass} < ActiveRecord::Base; def say_hello;
'Hello!'; end; end;"
   eval(model_string)
end

my_new_class = MyNewClass.new
my_new_class.say_hello -> "Hello!"

You can build up the string using the values defined in your hashes
and arrays then execute. I'm not sure what effect all this will have
on the execution time of you app, but try it out and see how you get
on.

Steve