From: Daniel N Date: 2006-06-08T11:38:42+09:00 Subject: Re: Using a string to find a class Hi Pat This ones come up a few times on the list http://www.ruby-forum.com/topic/66482#80672 is one that I remember particulalry. Although in some methods that I have seen in the rails source there has been string_name.camelize.constantize This will return a class object specified by name. eg def do_somthing( class_name ) obj = class_name.to_s.camelize.constantize obj.new end Hope this works for you On 6/8/06, Pat Maddox wrote: > I've got a string, and I want to find out if there's a class with that > name. So something like > > class_exists? "Foo" > > and then I can eval it if it does, I guess. Or is there a better way > than eval in that case? At any rate, I just want to be able to take a > string and find out if there's a class with that name or not. > > Thanks, > Pat > >