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



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

def sequence_separator
  @sequence_separator or defaults[:sequence_separator]
end

- (Object) slug_column

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



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

def slug_column
  @slug_column or defaults[:slug_column]
end

- (Object) slug_generator_class

Returns the value of attribute slug_generator_class



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

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.



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

def query_field
  slug_column
end