Ruby on Rails: Converting “SomeWordHere” to “some word here”

前端 未结 4 1063
夕颜
夕颜 2021-01-08 00:29

I know you can do something like:

\"SomeWordHere\".underscore.gsub(\"_\", \" \") 

to get \"some word here\".

I thought that might

4条回答
  •  借酒劲吻你
    2021-01-08 00:43

    Nope there is no built-in method that I know of. Any more efficient then a one-liner? Don't thinks so. Maybe humanize instead of the gsub, but you don't get exactly the same output.

提交回复
热议问题