s.constantize.find(:first) On Apr 17, 2008, at 5:44 PM, Glenn Little wrote:
> > Okay, now I've got some class names as strings... but I > want to use them as classes. How does one make that > happen. > > For instance, I want call a method on > class Author, but all I have is the string s = "Author". > I want to do something like: > > s.find(:first) > > to give me the first Author record. > > I'm thinking this is really a Ruby question. > > Thanks! > > -glenn > > > --~--~---------~--~----~------------~-------~--~----~ SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby -~----------~----~----~----~------~----~------~--~---
