Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

483
Views
How to use docx gem with amazon s3?

I have this create action to extract data from doc and docx files using the docx gem and the msworddoc-extractor gem

   if @subject.save
    if @subject.odoc.present?
      @odoc_url = @subject.odoc.url
      if File.extname(URI.parse(@odoc_url).path) == ".docx"
        @subject.homework= ""
        doc = Docx::Document.open(@odoc_url)
        doc.paragraphs.each do |p|
          @subject.homework = @subject.homework+p.to_html
        end
      else
        MSWordDoc::Extractor.load(@odoc_url) do |doc|
          @subject.homework= doc.whole_contents
        end
      end
      @subject.save
    end

now, doc files works fine.. My problem is with doc = Docx::Document.open(@odoc_url) when i use the code on my local machine it works fine.. when i push into production i get an error Zip::Error: File s3.amazonaws.com/~~~ not found I'm not really sure how to load the file to be accessible to the docx gem

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

So i finally got it without having to download the file using open-uri

doc = Docx::Document.open(open(@odoc_url).path)
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!