== Installation
<tt>./script/plugin install http://code.dunae.ca/acts_as_slugable</tt>
== 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
让url更人性化_acts_as_slugable
最新推荐文章于 2024-09-04 07:45:54 发布