Reputation: 5784
I have a problem when using paperclip. I can see the files uploaded but now i want to have a download link to download the "pdf file" when clicking on it.
I see this example:
<%= link_to "Download", model.whatever.url(:original, false) %>
But I can't figure out how to implement this with my own views and models.
Hope someone can help me.
EDIT:
here is my model:
class Contractgegeven < ActiveRecord::Base
has_attached_file :pdf
attr_accessible :bedrijfsonderdeel, :bestemd_voor, :betalingsgegevens, :betreft, :contractbeheerder, :contractduur, :einddatum, :ingangsdatum, :opzegtermijn, :soort_contract, :pdf
end
Upvotes: 0
Views: 3916
Reputation: 2276
Say your model is Image
, and you have :
class Image < ActiveRecord::Base
has_attached_file :picture
Then you should write:
Image.last.picture.url(:original, false)
not Image.last.url(:original, false)
Upvotes: 2