Module: FriendlyId::Slugged::Configuration

Defined in:
lib/friendly_id/slugged.rb

Overview

This module adds the :slug_column, and :sequence_separator, and :slug_generator_class configuration options to FriendlyId::Configuration.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#sequence_separatorObject

The string used to separate a slug base from a numeric sequence.

By default, -- is used to separate the slug from the sequence. FriendlyId uses two dashes to distinguish sequences from slugs with numbers in their name.

You can change the default separator by setting the sequence_separator configuration option.

For obvious reasons, you should avoid setting it to “-” unless you’re sure you will never want to have a friendly id with a number in it.

Returns:

  • String The sequence separator string. Defaults to “--”.



319
320
321
# File 'lib/friendly_id/slugged.rb', line 319

def sequence_separator
  @sequence_separator or defaults[:sequence_separator]
end

#slug_columnObject

The column that will be used to store the generated slug.



324
325
326
# File 'lib/friendly_id/slugged.rb', line 324

def slug_column
  @slug_column or defaults[:slug_column]
end

#slug_generator_classObject

Returns the value of attribute slug_generator_class.



298
299
300
# File 'lib/friendly_id/slugged.rb', line 298

def slug_generator_class
  @slug_generator_class
end

Instance Method Details

#query_fieldObject

Makes FriendlyId use the slug column for querying.

Returns:

  • String The slug column.



302
303
304
# File 'lib/friendly_id/slugged.rb', line 302

def query_field
  slug_column
end