If you’re using Rails, it provides a method called #constantize
that will work:
irb(main):017:0> Object.const_get 'House::Owns'
NameError: wrong constant name House::Owns
'House::Owns'.constantize
=> House::Owns
If you’re using Rails, it provides a method called #constantize
that will work:
irb(main):017:0> Object.const_get 'House::Owns'
NameError: wrong constant name House::Owns
'House::Owns'.constantize
=> House::Owns