Module FleskPlugins::ActsAsSluggable::InstanceMethods
In: lib/acts_as_sluggable.rb

Methods

_slug   _slug=   make_slug   to_param  

Public Instance methods

Retrieve this instance’s slug

[Source]

    # File lib/acts_as_sluggable.rb, line 36
36:       def _slug
37:         @_slug ||= make_slug(
38:           self.class.sluggable_attribute ?
39:             self.send(self.class.sluggable_attribute) :
40:             ''
41:         )
42:       end

Set this instance’s slug.

[Source]

    # File lib/acts_as_sluggable.rb, line 45
45:       def _slug=(slug)
46:         @_slug = slug
47:       end

Transform the initial string to the final slug. Override this to change the way slugs are created.

[Source]

    # File lib/acts_as_sluggable.rb, line 51
51:       def make_slug(string)
52:         string.to_s.downcase.gsub(/[^a-z1-9]+/, '-').gsub(/-+$/, '').gsub(/^-+$/, '')
53:       end

Create the :id parameter for a URL. This method is called when using url_for etc and passing a model instance as the :id parameter. E.g. link_to ‘Show article’, :action => ‘show’, :id => article

[Source]

    # File lib/acts_as_sluggable.rb, line 59
59:       def to_param
60:         self._slug.blank? ? id.to_s : "#{id}-#{self._slug}"
61:       end

[Validate]