Hi again Nerdture, According to the implementation of ActiveStorage::Attached::Changes::CreateOne <https://github.com/rails/rails/blob/master/activestorage/lib/active_storage/attached/changes/create_one.rb>, you should be able to access instance of* ActionDispatch::Http::UploadedFile <https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/http/upload.rb> *with following: self.attachment_changes['pv_file'].attachable
In you examples, you are trying to download file from a storage service to a tempfile before it has been uploaded, so storage service fails to locate it. Best, On Wednesday, December 4, 2019 at 7:53:03 PM UTC+1, Nerdture wrote: > > Thanks Mladen Ilic for your reply. > > I think I am getting closer to the solution I need. > > You should be able to access the attachment with >> `record.attachment_changes['pv_file']`. >> > > I must be doing something wrong, as I can't figure out how to access the > actual file contents/octet-stream. > > post_body << self.attachment_changes['pv_file'] > throws Zlib::Data Error incorrect header check > > post_body << self.attachment_changes['pv_file'].blob.download > throws Aws::S3::Errors::NoSuchKey > > post_body << self.attachment_changes['pv_file'].blob.open > throws ActiveStorage::FileNotFoundError > > I am sure I am showing my Ruby ignorance here. > > Any help is appriciated. > -- 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/deb73d0c-22c5-4187-8838-99b94820e43c%40googlegroups.com.