Based on https://github.com/technoweenie/permalink_fu
class Article < ActiveRecord::Base
has_permalink attr_names, permalink_field, options
end
:if
:unless
:unique
-true
by default:scope
- skipped when:unique
is set to false:update
-false
by default
Stores permalink form of title
to the permalink
attribute:
has_permalink :title
Stores a permalink form of "#{category}-#{title}"
to the permalink
attribute:
has_permalink [:category, :title]
Stores permalink form of category
to the category_permalink
attribute:
has_permalink :category, :category_permalink
Extend the scope within the parmalink should be unique:
has_permalink :title, :scope => :blog_id
Don't care if permalink in not unique:
has_permalink :title, :unique => false
Update the permalink every time the attribute(s) change:
has_permalink :title, :update => true