I have a class called ‘NewsItem’.
In one of my Rails classes, I have a place to pass in a string (from a
parameter). That string’s value is ‘NewsItem’, the class name.
How can I convert that to use as the class?
@model = params[:modelname]
@items = @model.find(:all)
This doesn’t work. I was hoping it would work the same way as:
@items = NewsItem.find(:all)
How can I pull this off?