Cat*_*ish 23 ruby ruby-on-rails ruby-on-rails-3
如果我点击此网址:http://localhost:3000/reports/action.xlsx
它会显示生成的xlsx文件.
如果我有link_to
这样的:<%= link_to 'Export to Excel', reports_affirmative_action_path, :format => :xlsx %>
,它会生成一个指向此页面的链接:
http://localhost:3000/reports/action
为什么我的link_to :format => :xlsx
没有链接到正确的路径?
San*_*eek 42
你link_to
和path
稍微偏了.你要
<%= link_to('Export to Excel', reports_affirmative_action_path(format: :xlsx)) %>
Run Code Online (Sandbox Code Playgroud)
格式是path
助手的参数,而不是link_to
.
归档时间: |
|
查看次数: |
11591 次 |
最近记录: |