Acts As Friendly Param
- acts_as_friendly_param
#
- blutak’d together by chrisfarms
#
#
#
- Use this act if you want your models to use more descriptive :id fields in URLs
- A model using acts_as_friendly_param may have a RESTful URL such as:
#
- /posts/4-the-day-the-earth-stood-still
#
- Its a VERY SIMPLE extension … but since I keep writing it I thought
- it should be pluginified
#
- thanks to Mephisto for the iconv character translation code
- and thanks to Obie Fernandez for blogging about overiding #to_param
#
#
#
#
#
- Note about strict URLs
#
- if you have to do any SEO work you will find that many search
- engines will penalize you for having multiple URLs pointing to the same
- page/resource.
#
- for this reason acts_as_friendly_param raises a ActiveRecord::RecordMoved
- if the ID in the url matches but the text string doesn’t
#
- this should give you a chance to catch the error and perform a 301 HTTP
- redirect to the correct resource.
- if you do not want this feature disable it like so:
#
- acts_as_friendly_param :name, :strict => false
#
#
NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly