Module: FriendlyId::Scoped::SlugGenerator

Defined in:
lib/friendly_id/scoped.rb

Overview

This module overrides FriendlyId::SlugGenerator#conflict to consider scope, to avoid adding sequences to slugs under different scopes.

Instance Method Summary (collapse)

Instance Method Details

- (Object) conflict (private)



161
162
163
164
165
166
167
168
# File 'lib/friendly_id/scoped.rb', line 161

def conflict
  columns = friendly_id_config.scope_columns
  matched = columns.inject(conflicts) do |memo, column|
     memo.where(column => sluggable.send(column))
  end

  matched.first
end