Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove multiple dashes in escaped URL

  • Loading branch information...
commit cd69ee0e262c3d96ba1846b5e797e48a92f05b77 1 parent e0953cf
@bumi bumi authored
Showing with 2 additions and 1 deletion.
  1. +1 −1  MIT-LICENSE
  2. +1 −0  lib/find_by_param.rb
View
2  MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2007 [name of plugin creator]
+Copyright (c) 2007 [Michael Bumann - Railslove.com]
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
1  lib/find_by_param.rb
@@ -65,6 +65,7 @@ def escape(str)
s = Iconv.iconv('ascii//ignore//translit', 'utf-8', str.dup).to_s
returning str.dup.to_s do |s|
s.gsub!(/\ +/, '-') # spaces to dashes, preferred separator char everywhere
+ s.gsub!(/\-+/,'-') # ----- to -
s.gsub!(/[^\w^-]+/, '') # kill non-word chars except -
s.strip! # ohh la la
s.downcase! # :D
Please sign in to comment.
Something went wrong with that request. Please try again.