Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以尝试自己做这件事,但由于 rails 已经经常处理这个问题,我想也许会有一个帮手。
我想要一个可以接受"object_name"和返回的函数"ObjectName"(也可以做相反的事情)。
"object_name"
"ObjectName"
谢谢
只要您包含 active_support(它在 rails 中),以下内容将适用于任何 ruby 项目:
"object_name".classify