to get decent SEO URLs in your rails app, app the following snippet to the model in question
#change the URL of the apps to be more SEO friendly
def to_param
"#{id}-#{parameterize}"
end
that would generate URLs as the following
http://www.barmajeyat.com/apps/1-tajweed
Nice tip, thanks!
You can get the same result with:
def to_param
“#{id}-#{name.parametrize}”
end
Nothing serious, but looks better :)
aah, There’s a typo in my previous comment. It’s “parameterize”. http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html#M001367
thanks for the tip Faisal, I have updated the post :>