Carrierwave recommends overriding store_dir in the uploader, but it only gives you a way to modify the directory name, not the whole path with the file name. Overriding store_path let's you modify the entire path.
def store_path(for_file = filename)
self.model.class.name.underscore.pluralize + "/" + self.model.slug + "/" + (version_name || :original).to_s + ".jpg"
endThis is the original:
def store_path(for_file=filename)
File.join([store_dir, full_filename(for_file)].compact)
end
Correct. It's been a while, but looking back at this, my version should be using
File.join, not+ "/". Although that's neither here, nor there.@denysonique you should definitely look at the existing carrierwave source (eg. compare
store_pathto the one above). In six months, a lot may have changed...