valkyrie
valkyrie copied to clipboard
Storage adapters should have #id_for
This should take the same parameters as #upload, but just return the ID that it would build when it's done.
Useful when you're not storing the resulting ID, and need to re-calculate it so you can find the file again.
would this just be #upload but with the file moving removed? so something like
def id_for(file:, original_filename:, resource: nil, **_extra_arguments)
new_path = path_generator.generate(resource: resource, file: file, original_filename: original_filename)
# FileUtils.mkdir_p(new_path.parent)
# file_mover.call(file.path, new_path)
# find_by(id: Valkyrie::ID.new("disk://#{new_path}"))
Valkyrie::ID.new("disk://#{new_path}")
end
Yeah that makes sense to me.