【发布时间】:2011-09-21 19:55:58
【问题描述】:
我有一个 Articles 模型和一个 Category 模型,都带有一个 url_slug 变量(我希望在查找它时显示在 url 中。这是我希望 URL 出现的方式:
//list all of the articles
http://example.com/articles
//list of all the articles in that category
http://example.com/articles/:category_slug
//a single article.
http://example.com/articles/:category_slug/:article_slug
我应该如何设置文章控制器和/或路由以实现此目的?
【问题讨论】: