Permalink
Browse files

Merge pull request #350 from linuxonrails/master

fix #330
  • Loading branch information...
norman committed Dec 13, 2012
2 parents 811ea88 + b3594e4 commit 9be8a227c8381dfab4956a04fc811726da0e695a
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/friendly_id/history.rb
@@ -127,7 +127,10 @@ def conflicts
scope = Slug.where("slug = ? OR slug LIKE ?", normalized, wildcard)
scope = scope.where(:sluggable_type => sluggable_class.to_s)
scope = scope.where("sluggable_id <> ?", value) unless sluggable.new_record?
- scope.order("LENGTH(slug) DESC, slug DESC")
+
+ length_command = "LENGTH"
+ length_command = "LEN" if sluggable.connection.adapter_name =~ /sqlserver/i
+ scope.order("#{length_command}(slug) DESC, slug DESC")
end
end
end

0 comments on commit 9be8a22

Please sign in to comment.