Module: Mongoid::SleepingKingStudios::Sluggable::ClassMethods
- Defined in:
- lib/mongoid/sleeping_king_studios/sluggable.rb
Overview
Class methods added to the base class via #extend.
Instance Method Summary collapse
-
#slugify(attribute, options = {}) ⇒ Object
Creates the :slug field and sets up the callback and validations.
-
#slugify_all! ⇒ Object
Loops through all documents in the collection.
-
#value_to_slug(value) ⇒ String
Converts the provided string to a slug value.
Instance Method Details
#slugify(attribute, options = {}) ⇒ Object
224 225 226 227 |
# File 'lib/mongoid/sleeping_king_studios/sluggable.rb', line 224 def slugify attribute, ** concern = Mongoid::SleepingKingStudios::Sluggable concern.apply self, attribute, end |
#slugify_all! ⇒ Object
Loops through all documents in the collection. If the document’s slug is blank, or if it does not match the base attribute value, calculates the value from the base attribute and assigns it atomically. Locked slugs (see the :lockable option) are unaffected.
Use this method to generate slugs when adding this concern to a model with existing documents.
|
# File 'lib/mongoid/sleeping_king_studios/sluggable.rb', line 229
|
#value_to_slug(value) ⇒ String
Converts the provided string to a slug value. Delegates to metadata.value_to_slug, so overriding this method will not change how slugs are generated.
|
# File 'lib/mongoid/sleeping_king_studios/sluggable.rb', line 240
|