sanitize
works with html strings, not URLs. this means that you cannot deactivate the url yourself, but you can clear the part of the html that has the link with the malicious url. eg
<%= sanitize "<a href='#{@url}'>Things</a>" %>
This will clear your link of all known malicious attributes.
source share