Ruby symbol to class
Rails
For use with Rails only.
With a string:
"Module".constantize #=> Module"Class".constantize #=> Class
With a symbol:
:module.to_s.classify.constantize #=> Module:open_struct.to_s.classify.constantize #=> OpenStruct
If you are dealing with a multi-word symbol, then you'll want to add #classify
to the chain to properly handle the capitalization of all the parts of the constant.
http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-constantize