Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

482
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda