Class FriendlyId::Configuration
In: lib/friendly_id/configuration.rb
Parent: Object

This class is not intended to be used on its own, it is used internally by `has_friendly_id` to store a model‘s configuration and configuration-related methods.

The arguments accepted by has_friendly_id correspond to the writeable instance attributes of this class; please see the description of the attributes below for information on the possible options.

@example has_friendly_id :name,

 :use_slug => true,
 :max_length => 150,
 :approximate_ascii => true,
 :ascii_approximation_options => :german,
 :sequence_separator => ":",
 :reserved_words => ["reserved", "words"],
 :scope => :country,
 :cache_column => :my_cache_column_name
 # etc.

Methods

Constants

DEFAULTS = { :ascii_approximation_options => [], :max_length => 255, :reserved_words => ["index", "new"], :reserved_message => 'can not be "%s"', :sequence_separator => "--"

External Aliases

method -> column
use_slug -> use_slugs=
use_slug? -> use_slugs?

Attributes

approximate_ascii  [RW]  Strip diacritics from Western characters.
ascii_approximation_options  [RW]  Locale-type options for ASCII approximations. These can be any of the values supported by {SlugString#approximate_ascii!}.
configured_class  [R]  The class that‘s using the configuration.
if  [RW]  Only generate friendly_id if :if/:unless evaluates to true/false (:if/:unless can be a Proc, method or a string)
max_length  [RW]  The maximum allowed length for a friendly_id string. This is checked after a string is processed by FriendlyId to remove spaces, special characters, etc.
method  [R]  The method or column that will be used as the basis of the friendly_id string.
normalizer  [RW]  A block or proc through which to filter the friendly_id text. This method will be removed from FriendlyId 3.0. @deprecated Please override the normalize_friendly_id
  method in your model class rather than passing a block to `has_friendly_id`.
reserved_message  [RW]  The message shown when a reserved word is used. @see reserved_words
reserved_words  [RW]  Array of words that are reserved and can‘t be used as friendly_id strings. If a listed word is used in a sluggable model, it will raise a FriendlyId::SlugGenerationError. For Rails applications, you are recommended to include "index" and "new", which used as the defaults unless overridden.
scope  [RW]  The method or relation to use as the friendly_id‘s scope.
sequence_separator  [RW]  The string that separates slug names from slug sequences. Defaults to "—".
strip_non_ascii  [RW]  Strip non-ASCII characters from the friendly_id string.
unless  [RW] 
use_slug  [RW]  Use slugs for storing the friendly_id string.

Public Class methods

Public Instance methods

This method will be removed from FriendlyId 3.0. @deprecated Please use {reserved_words reserved_words}.

This method will be removed from FriendlyId 3.0. @deprecated Please use {approximate_ascii approximate_ascii}.

[Validate]