There are some Blog posts out there about Rails and nice URLs for SEO. I don’t know if it really works, but it’s easy to do and nice URLs can never be wrong, can they?

There’s also a plugin called acts_as_sluggable which does exactly that, so that you can do things like


class BlogPost
  acts_as_sluggable :with => :title
end

And get URIS like

http://www.example.com/blogposts/3-my-cat-ate-my-flowers

There are some problems with act_as_slugable and Rails 1.2, though. Acts_as_sluggable comes with some ActiveRecord monkey patching for the find_from_ids method. As mentioned by Obie Fernandez this isn’t necessary for Rails 1.2 because Rails all the to_i-stuff itself. So if you want to use the plugin with Rails 1.2 just comment out the active_records_overrides.rb contents and you should be fine.

Related Posts