Want to sanitize a word in a view, how to include the SanitizeHelper module?

120 views Asked by At

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.

1

There are 1 answers

2
mechanicalfish On BEST ANSWER

You can use transliterate:

ActiveSupport::Inflector::transliterate "torbjörn" # => "torbjorn"