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

- (Object) sequence_separator

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 “--”.



306
307
308
# File 'lib/friendly_id/slugged.rb', line 306

def sequence_separator
  @sequence_separator or defaults[:sequence_separator]
end

- (Object) slug_column

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



311
312
313
# File 'lib/friendly_id/slugged.rb', line 311

def slug_column
  @slug_column or defaults[:slug_column]
end

- (Object) slug_generator_class

Returns the value of attribute slug_generator_class



285
286
287
# File 'lib/friendly_id/slugged.rb', line 285

def slug_generator_class
  @slug_generator_class
end

Instance Method Details

- (Object) query_field

Makes FriendlyId use the slug column for querying.

Returns:

  • String The slug column.



289
290
291
# File 'lib/friendly_id/slugged.rb', line 289

def query_field
  slug_column
end