Acts As Slugable plugin

Plugin details

Generates a URL slug based on a specific fields (e.g. title).

Websitehttp://code.dunae.ca/acts_as_slugable.html Repositoryhttp://code.dunae.ca/acts_as_slugable/ Author Alex Dunae Tags url, slug LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install http://code.dunae.ca/acts_as_slugable/

Usage examples
================

In your target table, add a column to hold the URL slug.


With scope
----------------

  class Page < ActiveRecord::Base
    acts_as_slugable :source_column => :title, :target_column => :url_slug, :scope => :parent
  end



Without scope
-----------------

  class Post < ActiveRecord::Base
    acts_as_slugable :source_column => :title, :target_column => :url_slug
  end



A sample link
--------------

  link_to @page.title, :action => 'show', :url_slug => @page.url_slug

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, 9 months ago