I encountered the following problem in the working draft. Initially was not properly selected directory structure to store files using carrierwave. Now you need to change the directory for existing files and rename them (the names are not unique).
Tried to do as described here
Get the error:
ArgumentError: wrong number of arguments (1 for 0)
from /team/mss/app/uploaders/route_point_photo_uploader.rb:30:in `swap_out_store_dir'
Old code:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{model.id}"
end
def filename
"photo.jpg" if original_filename
end
New code:
def store_dir
"uploads/#{model.class.to_s.underscore}"
end
def filename
"#{secure_token}.jpg" if original_filename
end
protected
def secure_token
var = :"@#{mounted_as}_secure_token"
model.instance_variable_get(var) or model.instance_variable_set(var, SecureRandom.uuid)
end