Ruby On Rails: Change Class Name Into Human Readable String
Join the DZone community and get the full member experience.Join For Free
This turns a class name (like LineItem) into a nice string (like "line item")
line_item = LineItem.new puts line_item.class.name.underscore.humanize.lowcase #spits out "line item"
Strings Data Types
Opinions expressed by DZone contributors are their own.