Fixed to work with Rails4 and support URL with spaces