【问题标题】:rails send_file with pdfrails send_file 和 pdf
【发布时间】:2012-09-18 00:25:36
【问题描述】:

非常简单...我只想显示我保存在公共目录中的本地 pdf 文件,而不是作为下载链接。所以我想我应该像这样使用 send_file:

<%= send_file("http://localhost:3000/exex11.pdf", :type => 'application/pdf', :disposition => 'inline') %>

但是,我得到:undefined methodsend_file' for #` 注意,我知道我应该使用 root_url 但我使用 localhost:3000 只是为了测试目的。

我检查了这只是为了确保文件在那里:

<%= link_to "The file", "http://localhost:3000/exex11.pdf" %>

【问题讨论】:

    标签: ruby-on-rails


    【解决方案1】:

    所以我想我应该像这样使用 send_file

    我想你应该在控制器的操作中使用它而不是在视图中使用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-18
      • 1970-01-01
      • 2014-01-05
      相关资源
      最近更新 更多