From: Glenn Date: 2009-01-28T22:22:26+09:00 Subject: Defining an ActiveRecord class within a method of another class --0-1586695007-1233149089=:10727 Content-Type: text/plain; charset=us-ascii Hi, I want to create a class and define a subclass of ActiveRecord within that class, like this: class Results def initialize(db) class db < ActiveRecord::Base end end end r1 = Results.new('DM') r2 = Results.new('AE') Then I want to put that class definition into an object and use it in the instance methods of the Results class. (The instance methods of the Results class will do stuff with database tables, but I want to pick which table when I create the instances of the Results class.) I am sure that the syntax above is wrong -- probably in many ways -- but am unsure how to fix it. Ruby does not seem to want to allow class definitions within methods, but if I can't do that, I do not know of another way to do this. Thanks for your help. --0-1586695007-1233149089=:10727--