From: Tsunami Scripter Date: 2009-01-28T23:25:51+09:00 Subject: Re: Defining an ActiveRecord class within a method of another class Sorry , I pasted the same thing twice irb(main):042:0> class Res irb(main):043:1> def self.get(cls) irb(main):044:2> eval("class #{cls};end") irb(main):045:2> return eval("#{cls}.new") irb(main):046:2> end irb(main):047:1> end => nil irb(main):048:0> x = Res.get("G") => # irb(main):049:0> x.class => Res::G -- Posted via http://www.ruby-forum.com/.