문제

I have words like the following: "torbjörn".

I want to replace special characters like the 6th letter "ö" with the latin equivalant, i.e. "o".

I assume the module SanitizeHelper will do this for me, but I don't understand how and where to include it.

I just need this for one view, so if it's favorable to not include it for the whole app, I would like to have that taken in mind as well.

도움이 되었습니까?

해결책

You can use transliterate:

ActiveSupport::Inflector::transliterate "torbjörn" # => "torbjorn"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top