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

#conflictObject (private)



139
140
141
142
143
144
145
146
# File 'lib/friendly_id/scoped.rb', line 139

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

  matched.first
end