夜鸣猪 发表于 2013-2-7 19:21:13

关于router restful和button_to

今天费了一些时间啊一个很久之前遇到过的问题又忘了
Rails 3
写了个路由
get "report/index"get "report/show"

rake routes可以知道

   report_index GET    /report/index(.:format)         {:controller=>"report", :action=>"index"}      report_show GET    /report/show(.:format)          {:controller=>"report", :action=>"show"}

于是,就写了个button_to

%h1 Report#show= button_to('click', :action => 'index',:method=>:get)

发现诡异现象,点击就会提示没有路由,地址栏回车就能显示。

我就记着很久之前遇到过这个问题,可是就是想不起来怎么回事。

后来看后台信息和地址栏,发现问题
<div class="quote_title">引用
页: [1]
查看完整版本: 关于router restful和button_to