-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restructure uploaded file paths and improve instructions for migrating to S3 #2365
Conversation
paperclip: | ||
storage: filesystem | ||
url: ":rails_relative_url_root/:attachment/:id_partition/:style/:safe_filename" | ||
path: ":rails_root/public/:attachment/:id_partition/:style/:safe_filename" | ||
url: ":rails_relative_url_root/system/:class/:attachment/:id_partition/:style/:safe_filename" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could see an argument that we shouldn't change the default and just make the changes downstream, but I don't like where it's currently stored.
NU is already using the class
-prefixed paths on S3.
end | ||
end | ||
def move_record(new_class, old_record) | ||
new_record = new_class.find(old_record.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth adding a guard clause here to do some logging and skip any invalid old_record
s? I don't expect there to be any invalid records but since we're saving with validate: false
I thought it might make sense to check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small non-blocking comment. Looks good! The branch just needs to be brought up to date.
Release Notes
Tech task: Update the file paths for uploaded files and improve instructions and helper rake takes to aid in migrating to S3.
Breaking changes
The setting for where uploaded files are stored locally has changed from
public/files
topublic/system/:class
. You either need to change it back to its previous value or run the rake task as part of your deployment (CHANGELOG.md).In addition, if you are using S3 already, the path for the keys should now just be
paperclip.aws_access_key
andpaperclip.aws_secret_access_key
.Notes
We'll need to update the access keys for NU, but their file paths in S3 already have the
:class
interpolation variable, so nothing should need to move for them.