Why does Rails titlecase add a space to a name?

前端 未结 10 1177
我在风中等你
我在风中等你 2021-02-05 10:28

Why does the titlecase mess up the name? I have:

John Mark McMillan

and it turns it into:

>> \"john mark McM         


        
10条回答
  •  逝去的感伤
    2021-02-05 10:38

    The documentation for titlecase says ([emphasis added]):

    Capitalizes all the words and replaces some characters in the string to create a nicer looking title. titleize is meant for creating pretty output. It is not used in the Rails internals.

    I'm only guessing here, but perhaps it regards PascalCase as a problem - maybe it thinks it's the name of a ActiveRecordModelClass.

提交回复
热议问题