Answer the question
In order to leave comments, you need to log in
Uploading carrierwave files to a subdomain?
Hello!
I dug out config.asset_host in the settings, and there you can specify which domain will be added to the path to the file
. But I don’t understand how to upload files to a subdomain (adjacent folder with the project), and so that later I pull out a link through image_url, that subdomain is taken, and accordingly the path to the file?
Answer the question
In order to leave comments, you need to log in
This parameter is not intended for uploaded files, but for application assets - styles, js code, icons.
Carrerwave can be used with S3 to store files not on the machine where the application is running. Or what do you mean by uploading to a subdomain?
To upload to a different folder on the machine, you need to configure the carrierwave uploader
class FileUploader < CarrierWave::Uploader::Base
def store_dir
model_class = model.has_attribute?(:type) ? model.type : model.class.to_s
"uploads/#{model_class.underscore}/#{mounted_as}/#{model.id}"
end
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question