D
D
dexdev2014-01-06 12:43:32
Ruby on Rails
dexdev, 2014-01-06 12:43:32

Why after deploy'a the pictures uploaded by users are not loaded?

Hello everyone, Happy New Year, the problem is the following, users load avatars using CarrierWave
after the next deployment of the avatar, it blows away with the wind ...
The action takes place on a VPS.
The question is what to do so that after the deployment, the avatars do not fly off ...

class AvatarUploader < CarrierWave::Uploader::Base

  # Include RMagick or MiniMagick support:
  include CarrierWave::RMagick
  # include CarrierWave::MiniMagick

  # Choose what kind of storage to use for this uploader:
  storage :file
  # storage :fog

  def root
  Rails.root.join 'public/'
end

  # Override the directory where uploaded files will be stored.
  # This is a sensible default for uploaders that are meant to be mounted:
  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexesDev, 2014-01-06
@alexesDev

Well, it's worth pointing out that you use Mina. She does not know that your downloads folder should be a shared resource, so the avatars after deployment remain in the old version of the project (the mine keeps the latest versions of the project for quick rollback).
You need to add the folder path here nadarei.co/mina/settings/shared_paths.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question