Organise Active Storage files for use in other systems?

前端 未结 1 884
猫巷女王i
猫巷女王i 2021-01-28 15:28

Active Storage stores uploads in a file structure like so:

This is great if the rails app is the only software that needs to use these files.

But what if t

相关标签:
1条回答
  • 2021-01-28 15:55

    As far as I remember, you would have to implement an own service that somehow replace the key used to something else (e.g. S3Service), or patch ActiveStorage to create the key itself in a different way. I am not sure that this would suffice though, as the key is most likely used for other critical functionality outside of the Service.

    Alternatively you might poke in ActiveStorage::Blob to fiddle with the key. That said, ActiveStorage does not support what you'd like out of the box and you would have to take the risk of messing with its internals.

    A solution to the problem (but not answer to you question) might be implementing an API as outlined in the comments to your question.

    0 讨论(0)
提交回复
热议问题