Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

automate attachment changes which affect the path #2149

Closed
dwickwire opened this issue Mar 24, 2016 · 3 comments
Closed

automate attachment changes which affect the path #2149

dwickwire opened this issue Mar 24, 2016 · 3 comments

Comments

@dwickwire
Copy link

Hello,

Given a path definition which contains attributes such as:

  has_attached_file :item,
    path: 'path/to/file/:name.:extension',
    storage: :s3

If the name attribute changes, paperclip does not "update" or "move" the external file by renaming it (in this case). This is also true for non S3 storage settings.

This is problematic for obvious reasons because everyone using paperclip who wants to use any attribute in the path must handle updates manually.

This appears to be a known "issue" and is addressed in the wiki here:
https://github.com/thoughtbot/paperclip/wiki/Changing-attachment-:path

Personally I consider this a basic or even expected feature that others may benefit greatly from having so before I consider contributing a PR with this support, I'd like to ask:

  1. Is there any known reason not to integrate this behavior into paperclip?
  2. Has this been attempted elsewhere and failed before already?
  3. Are others interested in this feature as much as I think they are?
@uiltondutra
Copy link

Hi @dwickwire! A feature like this will add complexity. If you know you are changing an attribute that impact your attachment path, wouldn't be easier to just update the image attribute after saving the model?

@dwickwire
Copy link
Author

Hello @uiltondutra, that's an interesting idea which seems simpler, but it wouldn't actually satisfy the missing behavior this feature suggests, it circumvents it. Updating an image attribute after saving the model doesn't change the remote/local path structure on disk thus doesn't satisfy the given expectation that when a file is moved, or when a directory is renamed, that it should take effect wherever relevant.

Moving files or renaming directories (locally or remotely) adds behavior, yes. However calling it "complex" suggests its outside the scope of what Paperclip is for, file management is what paperclip does.

@sidraval
Copy link
Contributor

Thank you for reporting this. Unfortunately, we will be deprecating Paperclip and therefore will not have the bandwidth to address this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants