How do i have a variable such that sometime I can do
Foo.find(id)
or sometimes
Bar.find(id)
there not constants so .constantize won't work =\
How do i have a variable such that sometime I can do
Foo.find(id)
or sometimes
Bar.find(id)
there not constants so .constantize won't work =\
klass = Foo # This could easily be in some kind of conditional statement
klass.find(...)
and of course Foo
and Bar
in your example are constants, so you could easily also do
"Foo".constantize.find(...)