activeresource icon indicating copy to clipboard operation
activeresource copied to clipboard

Support for multipart/form-data

Open PedroAugustoRamalhoDuarte opened this issue 1 year ago • 1 comments

First of all, thanks for this gem it helps a lot.

Problem

I encountered a challenge while attempting to integrate this gem with another Rails application that utilizes Active Storage. My objective was to send files, but upon inspecting the source code and conducting some research, I discovered that there is currently no direct method to achieve this.

Desired API:

Media.create!(name: "Teste",
              media_type: "book",
              file: File.new("test/fixtures/files/test.txt"))

I noticed that there is a format option available for overriding, but it isn't sufficient for sending a multipart request with Net::HTTP. I started working on implementing this feature, but it seems like it would require a significant refactoring effort to make it functional. I'm curious to know your thoughts on whether it would be appropriate to add this functionality directly to this gem, or perhaps consider it as a feature in another gem as a plugin.

I'd be happy with a PR, but we have no plans to work ourselves to implement new feature on this gem.

rafaelfranca avatar Jan 24 '24 19:01 rafaelfranca