我正在尝试创建一个链接以从文件系统下载文件。为此,我在“license_helper.rb”文件中定义了以下内容:
def license_download_link(license, link_text = nil)
if link_text.blank?
link_text = image_tag("download_icon.png", :border => 0, :width => 32, :height =>32, :alt => 'Download License', :title => 'Download License')
end
licenseFileId = license.asset.serial_number
send_file '#{licenseFileId}license.xml', :type => "application/xml", :filename => "#{licenseFileId}license.xml"
#send_file ' "#{licenseFileId}license.xml" ', :disposition => 'inline'
#send_file("#{licenseFileId}license.xml", :type => :xml)
#link_to link_text, '#{"C:\\Entitlement\\trunk\\entitlement_site\\entitlement\\25license.xml"}'
end
我的“视图”只是调用这个助手类:
<td><%= license_download_link(license, ' ') %></td>
当我尝试查看该页面时,我收到以下错误消息:
undefined method `send_file' for #<ActionView::Base:0x5fb3650>
如您所见,我尝试了很多方法来调用“send_file”,但总是得到相同的错误消息。任何帮助将不胜感激,感谢您的时间,问候,--- AJ