0
我想发送一个电子邮件与一些链接从我的s3桶下载。我有存储在表中的文件的URL。我怎样才能使用link_to助手?链接下载一个文件在rails
<%= link_to "Download File x", @profile.document %>
我想发送一个电子邮件与一些链接从我的s3桶下载。我有存储在表中的文件的URL。我怎样才能使用link_to助手?链接下载一个文件在rails
<%= link_to "Download File x", @profile.document %>
因为我想这@profile.document
是全合格的URL,你不需要link_to
帮手,只需使用:
<a href="<%= @profile.document %>">doc</a>`.
使用link_to
当你有一个资源实例(如个人资料可能)是在config/routes.rb
文件中定义。例如:
resources :profile
那么当你使用
<%= link_to 'download', @profile %>
,你将有
http://test.com/profiles/34234