spree/spree — pull request #1287 by BGuimberteau (2012-03-18 09:48:38+00:00)
Title: Permalink creation failure for similar names - 1254

Solution for this Issue https://github.com/spree/spree/issues/1254

Just need to add a condition on the filter :

# Do other links exist with this permalink?
other = self.class.first(
:conditions => "#{field} LIKE '#{permalink_value}%' AND #{field} NOT LIKE '#{permalink_value}-%-%'",
:order => "LENGTH(#{field}) DESC, #{field} DESC"
)

Have a nice day