六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 93|回复: 0

关于router restful和button_to

[复制链接]

升级  40.8%

220

主题

220

主题

220

主题

进士

Rank: 4

积分
704
 楼主| 发表于 2013-2-7 19:21:13 | 显示全部楼层 |阅读模式
今天费了一些时间啊一个很久之前遇到过的问题又忘了
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">引用
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表