I've got a sinatra app where I plan to make a friedly-urls on the fly. I've got a function with a regexp that looks like this, but it won't turn 'spaces' into 'dashes', ' ' to '-'.
def self.make_slug(title)
title.downcase.gsub(/ /, '-').gsub(/[^a-z0-9_]/, '').squeeze('-')
end
Thanks in advance!
Update
Now I'm also trying to change åä into a and ö into o, my code looks like this but won't work, any ideas?
gsub(/[åä]/, 'a')
gsub(/[ö]/, 'o')