原创作者: hideto   阅读:1117次   评论:0条   更新时间:2011-05-26    
我们希望按如下url来查看articles archive:
http://localhost/articles
http://localhost/articles/2007
http://localhost/articles/2007/9
http://localhost/articles/2007/9/28
我们可以这样定义routes:
# in routes.rb
map.connect 'articles/:year/:month/:day', :controller => 'articles',
  :month => nil, :day => nil, :requirements => { :year => /\d{4}/ }
评论 共 0 条 请登录后发表评论

发表评论

您还没有登录,请您登录后再发表评论

文章信息

Global site tag (gtag.js) - Google Analytics