Acts as Friendly Param plugin
Plugin details
Documentation
ruby script/plugin install http://chrisfarms.googlecode.com/svn/rails/plugins/acts_as_friendly_param
declare a field in your model that you wish to use for the textual slug with the acts_as_friendly_param macro.
class Post < ActiveRecord::Base acts_as_friendly_param :name end
The result of the Post#name method will be appended to the URL
helpers like:
<%= link_to 'view post', :action => 'show', :id => @post %>
will produce URLs like
/posts/12-monkies-are-coming
Unicode Concerns
================
Although many unicode characters are actually valid in URIs, the rails url helpers are quite strict with their escaping and you can end up with some pretty ugly urls. It is also good for searching if e and é are treated equally.
So.. friendly-param will try to tidy up the following:
- remove any accents from characters
- strip out any plain-crazy characters (Omega, Pi etc)
- convert spaces into hyphens
SEO Concerns
============
To prevent multiple URLs pointing to the same resource, and having a negative effect on search-engine ranking, friendly-url will use 301 redirects on any ambiguous GET requests.
The following behavior should be expected
- trailing slashes will be removed from URLs
- requests for resources using incorrect slugs will be redirected to the the correct URL
- if the routes file is drastically modified then any old URLs that
still work will be redirected to there new equivalent.
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | Back in time (4 older versions) | Last edited by: scott, 7 months ago

