I am working on building an API front end for a 3rd Party API.  In addition 
to collecting the file from my user, I also need to post the file to the 
3rd Party Service.

The only way I have been able to get the actual file contents is to 
download it again after it has been saved.

class Template < ApplicationRecord
    has_one_attached :pv_file
...
    post_body << self.pv_file.blob.download

I want to have a before create filter that throws an error if the 3rd Party 
API rejects the file (e.g. wrong format, service unavailable, etc), but the 
only way I have found to access the file content is by downloading it again.

How can we access the actual file content before it has been saved and 
uploaded?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-core/808b4f3c-fa98-4624-91ce-d55f934c56b0%40googlegroups.com.

Reply via email to