且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Rails 3中创建SEO友好的URL

更新时间:2023-11-07 22:54:40

match '/:category_slug/:country_slug', :to => 'things#index'

然后,您需要更新操作以使用params查找所有内容[ :category_slug]和params [:country_slug]而不是ID。查看弹sl的宝石以生成弹ug。

Then you'll need to update your action to look up everything using params[:category_slug] and params[:country_slug] instead of the ids. Look at the slugged gem to generate slugs.