From: Enrique Comba Riepenhausen Date: 2007-06-15T23:41:44+09:00 Subject: Re: Dynamic Class Initialization Hi Peer, On Friday, June 15, 2007, at 04:36PM, "Peer Allan" wrote: >Hi all, >I know this can be done, but I can't find out how to do it. I have a >string with the name of the class that I want to initialize, but how do >I do it? > >This is what I tried, > >class = "Product" >product = class.new > >Obviously this does not work or I wouldn't be asking :) So, how do I do >this? > >Peer Try this: clazz = Object.const_get("Product") product = clazz.new The word class is a reserved word so yu should use something different... Cheers, Enrique