Forum: Ruby on Rails Does a method string.to_class exist?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Richard S. (Guest)
on 2008-12-02 22:31
I have A Definition model, is it possible to do something like this in
Rails 2.1.0, Ruby 1.8.6 :

foo = "Definition"
@definition = foo.to_class.find(:all)
Frederick C. (Guest)
on 2008-12-02 23:24
(Received via mailing list)
On Dec 2, 8:31 pm, Richard S. <rails-mailing-l...@andreas-
s.net> wrote:
> I have A Definition model, is it possible to do something like this in
> Rails 2.1.0, Ruby 1.8.6 :
>
Have a look at constantize.

Fred
Richard S. (Guest)
on 2008-12-03 00:30
As always, your advice worked like a charm!! Don't know how i missed
that method the first time over...anywhoo thanks again!
This topic is locked and can not be replied to.