Domanda

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.

È stato utile?

Soluzione

You can use transliterate:

ActiveSupport::Inflector::transliterate "torbjörn" # => "torbjorn"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top