Re: Is eval the only way?

Inside Rails, you can do:
x = class_name.constantize.find(:all, :conditions => “#{conditions}”)

constantize is a more-readable shortcut for the const_get business.

Thanks Wilson! – That works like a charm.

: )

Jason

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs