module Mongoid::SleepingKingStudios::Sluggable::ClassMethods

Class methods added to the base class via extend.

Public Instance Methods

slugify(attribute, **options) click to toggle source

@overload slugify attribute, options = {}

Creates the :slug field and sets up the callback and validations.

@param [String, Symbol] attribute The base field used to determine
  the value of the slug. When this field is changed via its writer
  method, the slug will be updated.
@param [Hash] options The options for the relation.
@option options [Boolean] :lockable
  The :lockable option allows the manual setting of the :slug field.
  To do so, it adds an additional :slug_lock field, which defaults to
  false but is set to true whenever #slug= is called. If the slug is
  locked, its value is not updated to track the base attribute. To
  resume tracking the base attribute, set :slug_lock to false.

@raise [Mongoid::Errors::InvalidOptions] If any of the provided
  options are invalid.
# File lib/mongoid/sleeping_king_studios/sluggable.rb, line 224
def slugify attribute, **options
  concern = Mongoid::SleepingKingStudios::Sluggable
  concern.apply self, attribute, options
end