lib/sluggable_finder/orm.rb in sluggable_finder-2.3.4 vs lib/sluggable_finder/orm.rb in sluggable_finder-2.3.5

- old
+ new

@@ -20,10 +20,11 @@ :to => :slug, :reserved_slugs => [], :allow_integer_ids => true, :upcase => false, :slug_modifier => slug_modifier || nil, + :separator => '-', :ignore_sti => false # if true, Uniqueness won't check sibling classes. }.merge( options )) class_inheritable_reader :sluggable_finder_options if sluggable_finder_options[:scope] @@ -106,10 +107,10 @@ conds_sql = "#{cond}#{destination_column} LIKE ? and #{scope_condition}" conds_sql << " and #{_type_column} = '#{_class_name}'" if sluggable_finder_options[:ignore_sti] existing = slugable_class.find(:first, :conditions => [conds_sql, proposed_slug + suffix]) while existing != nil or sluggable_finder_options[:reserved_slugs].include?(proposed_slug + suffix) if suffix.empty? - suffix = "-2" + suffix = "#{sluggable_finder_options[:separator]}2" else suffix.succ! end existing = slugable_class.find(:first, :conditions => ["#{cond}#{destination_column} = ? and #{scope_condition}", proposed_slug + suffix]) end