2013-01-31 104 views
0

我想发送一个电子邮件与一些链接从我的s3桶下载。我有存储在表中的文件的URL。我怎样才能使用link_to助手?链接下载一个文件在rails

<%= link_to "Download File x", @profile.document %> 

回答

0

因为我想这@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