1

I currently am using carrierwave to upload files to active admin. The way I have it now, I can successfully upload files. The problem now is that I cannot download the files once they are uploaded. Here is my uploads.rb file.

ActiveAdmin.register Upload do
form(:html => { :multipart => true}) do |f|
    f.inputs "Upload" do
      f.input :name
      f.input :attachment
      f.input :user_id
      f.input :upload_type
    end
    f.actions 
  end

  index do
    column :name
    column :attachment do |upload|
      link_to upload.attachment_url.to_s unless upload.attachment_url == nil
    end
    column :user_id
    column :upload_type
    default_actions
  end

  show do
    attributes_table do
      row :name
      row :attachment do |upload|
        link_to upload.attachment_url.to_s unless upload.attachment_url == nil
      end
      row :user_id
      row :upload_type
    end
  end
end

When I go to the index or show view, the file (in this example my resume) looks to be uploaded correctly but I cannot download the link once I click on it.

user2184718
  • 675
  • 1
  • 12
  • 30
  • Is the link valid? What happens when you click it (404, etc)? What does the -fox- server log say? – Mike Szyndel Dec 17 '13 at 20:28
  • Are the files being uploaded locally or to a CDN (S3 et al)? BTW, a safer presence test would be `if upload.attachment?` or `unless upload.attachment_url.blank?`. Just because it's not equal to nil doesn't mean it's not an empty string. – Josh Kovach Dec 21 '13 at 19:24

0 Answers0