让url更人性化_acts_as_slugable

== 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

你可能感兴趣的:(ActiveRecord)