Reputation: 3807
I looked into this plugin called acts_as_permalinkable at github and found it to be useful. Do you know of any other plugin that generates search engine friendly urls for ruby on rails models in a better way?
Upvotes: 1
Views: 376
Reputation: 9577
there is always just to_params in your model which can display basically whatever you want. Just note that your methods in that model will have to change, when you use find.
e.g. in the post.rb file
def to_param
name.parameterize
end
and in your posts_controller.rb methods that usually pick up the params[:id] call, you just have to change them to:
@post = Post.find_by_name(params[:id])
no plugin, no fuss and still pretty urls.
Upvotes: 0
Reputation: 14213
acts_as_urlnameable does the trick as well. I haven't used permalinkable, so I can't say that it is better. Does it have some specific deficiencies that concern you?
It lives at: http://code.helicoid.net/svn/rails/plugins/acts_as_urlnameable/
Upvotes: 0