Posts

Showing posts with the label carrierwave

How to download an uploaded file in Cloudinary

Image
Clash Royale CLAN TAG #URR8PPP How to download an uploaded file in Cloudinary i'm currently working on how to download an uploaded file in Cloudinary. In my views/declarations/index , I want a button to download the file the user uploaded at the Declaration.create . views/declarations/index Declaration.create I've tried the this : <% @declarations.each do |declaration| %> <tr> <td><%= link_to("Download", cl_private_download_url(declaration.facture, :png, :attachment => true)) %></td> </tr> <% end %> But all I have is something like this : #Attachinary::File:0x00007fa7deca0f20 Does one of you know how could I do this ? Many thanks, You need to link to a controller method that actually handles the file transfer. This method receives the declaration ID, pulls the record, fetches the file, and serves it. – bo-oz 3 hours ago ...

Carrierwave: Encoding::UndefinedConversionError (“xFF” from ASCII-8BIT to UTF-8)

Image
Clash Royale CLAN TAG #URR8PPP Carrierwave: Encoding::UndefinedConversionError (“xFF” from ASCII-8BIT to UTF-8) I'm trying to upload multiple files to a record called Post , with a json attribute called images , using Carrierwave. But when I try to save the record, I get this error: Post images (0.5ms) ROLLBACK Completed 401 Unauthorized in 15ms (ActiveRecord: 0.8ms) Encoding::UndefinedConversionError ("xFF" from ASCII-8BIT to UTF-8): I've used Carrierwave before and I never got this error. I checked if anyone's had this problem, before, and I didn't find much. This question suggested the activesupport-json_encoder gem, but this gem isn't compatible with Rails 5. Also suggested were the force_encoding method and using a "wb" flag when saving the file, but the Carrierwave code has no place to implement those suggestions. activesupport-json_encoder force_encoding Here's the code I have: form <%= form_for @post, :html => {multipart: t...