【发布时间】:2011-12-31 06:24:10
【问题描述】:
我做rake routes时有以下情况
next_post /users/next_post/:index(.:format) {:controller=>"users", :action=>"next_post"}
然后,当我的 ERB 文件中有此代码时:
<%= link_to "next", :next_post %>
我收到以下错误,我就是想不通
没有路由匹配 {:controller=>"users", :action=>"next_post"}
我在这里做错了什么?路线本身是这样的
match '/users/next_post/:index',
:controller => "users",
:action => 'next_post',
:as => :next_post
【问题讨论】:
-
:index参数是干什么用的? -
我正在传递我想要返回的帖子的索引。例如,您在第 4 个帖子上,并且想要继续前进。我会通过 5