Ruby on Rails: Change class name into human readable string
1 2 line_item = LineItem.new 3 puts line_item.class.name.underscore.humanize.lowcase #spits out "line item"
DZone Snippets > thechrisoshow > ruby
12729 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Chris O'Sullivan http://www.thechrisoshow.com
1 2 line_item = LineItem.new 3 puts line_item.class.name.underscore.humanize.lowcase #spits out "line item"