I was testing this line and there seems to be slight problem with this line: If upload-dir is undefined, the upload path is set to /<filename>. The causes s3 to create a folder with name "" and stick the files in it. Can this be rewritten to join("/") only if :upload_dir is undefined? Apologies for asking but I'm still trying learn ruby's beautiful function chaining methods.