Convert string to class

hey,

i have these parameters
/backend/fsdocuments/new?parent_class=Product&parent_id=5

parent_id = params[:parent_id] => “5”
parent_class = params[:parent_class] => “Product”

So i need to find Product item with id = 5

Product.find(5)

But how can i convert this string to a object??

Thx

Nick B. wrote:

Product.find(5)

But how can i convert this string to a object??

Thx


Posted via http://www.ruby-forum.com/.

“Hash”.constantize.new #=> {}

_Kevin

_Kevin wrote:

Nick B. wrote:

Product.find(5)

But how can i convert this string to a object??

Thx


Posted via http://www.ruby-forum.com/.

“Hash”.constantize.new #=> {}

_Kevin

thx it works