Rails Rails 4.1 link_to 中 format 参数不起作用

jksharer · June 04, 2014 · Last by jksharer replied at June 04, 2014 · 2055 hits
在浏览器中输入 localhost:3000/users.xls能自动下载xls文件。
而<%= link_to "导出为Excel", users_path(format: 'xls') %>, 链接无效,点击无反应。

连<a href="/users.xls">导出为Excel</a    也不起作用?

查了一下,好像rails4.1 已经不支持format参数?  求大牛指教。

肯定是你哪里写错了

关掉 turbolinks 看看

#2 楼 @Rei 多谢。找了个临时办法,在 action 中再 redirect_to‘users.xls’,就起作用了。

You need to Sign in before reply, if you don't have an account, please Sign up first.