Module: FriendlyId::SequentiallySlugged

Defined in:
lib/friendly_id/sequentially_slugged.rb

Defined Under Namespace

Classes: SequentialSlugCalculator

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.setup(model_class) ⇒ Object


3
4
5
# File 'lib/friendly_id/sequentially_slugged.rb', line 3

def self.setup(model_class)
  model_class.friendly_id_config.use :slugged
end

Instance Method Details

#resolve_friendly_id_conflict(candidate_slugs) ⇒ Object


7
8
9
10
11
12
13
14
15
# File 'lib/friendly_id/sequentially_slugged.rb', line 7

def resolve_friendly_id_conflict(candidate_slugs)
  candidate = candidate_slugs.first
  return if candidate.nil?
  SequentialSlugCalculator.new(scope_for_slug_generator,
                              candidate,
                              friendly_id_config.slug_column,
                              friendly_id_config.sequence_separator,
                              slug_base_class).next_slug
end

#slug_base_classObject (private)


79
80
81
82
83
84
85
# File 'lib/friendly_id/sequentially_slugged.rb', line 79

def slug_base_class
  if friendly_id_config.uses?(:history)
    Slug
  else
    self.class.base_class
  end
end