我想将一个参数传递给索引操作,但我只是获取了show动作.
routes.rb中:
Test1::Application.routes.draw do resources :blog end
blog_controller.rb:
def show # code end def index # code end
查看发送以显示操作的网址,而不是索引操作:
<a href="/blog/myvar"> My link </a>
输出我的路线:
$rake routes blog GET /blog(.:format) {:action=>"index",:controller=>"blog"} blog GET /blog/:id(.:format) {:action=>"show",:controller=>"blog"}