views:

18

answers:

1

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 =\

+1  A: 
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(...)
Gareth
oh. well then I'm golden.
DerNalia