Reputation: 7941
I'm using Paperclip to upload a .js
file.
My model (Bypassing validation just for Testing Purposes):
# Script Asset
has_attached_file :asset
do_not_validate_attachment_file_type :asset
The upload itself works as it should, but how to open the uploaded file so i can display it in the View?
I tried and searched a lot, but i can't find a working solution. Just passing <%= @test.asset %>
brings back the path of the Document.
Do i have to write a method for passing the Document to a text
?
Upvotes: 1
Views: 406
Reputation: 3962
Paperclip.io_adapters.for(@test.asset).read
Doesn't require writing to (and removing from) the local file system.
Upvotes: 1