Module: Slugable::HasSlug

Defined in:
lib/slugable/has_slug.rb

Defined Under Namespace

Classes: MethodBuilder

Instance Method Summary collapse

Instance Method Details

#has_slug(options = {}) ⇒ Object

USAGE generate before save filter for filling slug from name attribute, and parameterize slug attribute you can change default columns by passing :from and :to attributes

it also generate method to_slug (depanding od :to param), which generate slug url for link_path

has_slug # generate to_slug has_slug from: :title # generate to_slug has_slug to: :seo_url # generate to_url has_slug from: :name, to: :slug # generate to_slug



32
33
34
# File 'lib/slugable/has_slug.rb', line 32

def has_slug(options = {})
  MethodBuilder.build(self, options)
end