使用回形針時出現問題。 我可以看到上傳的文件,但現在我想要有一個下載鏈接,點擊它時下載「pdf文件」。下載上傳的文件paperclip
我看到這個例子:
<%= link_to "Download", model.whatever.url(:original, false) %>
但我無法弄清楚如何使用我自己的看法和模型實現這一點。
希望有人能幫助我。
編輯:
這裏是我的模型:
class Contractgegeven < ActiveRecord::Base
has_attached_file :pdf
attr_accessible :bedrijfsonderdeel, :bestemd_voor, :betalingsgegevens, :betreft, :contractbeheerder, :contractduur, :einddatum, :ingangsdatum, :opzegtermijn, :soort_contract, :pdf
end
你可以發佈你的模型? –
Didi你試試'Contractgegeven.last.pdf.url(:original)'? –
我會嘗試:) –