Running directly "SimpleProduct".titleize
should do the work
Reference: http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-titleize
Question
Rails injects a lot of neat helpers into String which it uses for its "magic".
I have a string "SimpleProduct" and want to represent that as "Simple Product".
Right now, I only see how to do this using four of these helpers:
"SimpleProduct".tableize.singularize.humanize.titleize
Is there a cleaner and simpler way? Am I overlooking an obvious helper?
Solution
Running directly "SimpleProduct".titleize
should do the work
Reference: http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-titleize