caxlsx_rails: undefined method `reopen' for "streamed":String

I’m using axlsx rails 0.1.5 with rvm, ruby-2.1.0 and rails 4.0.4,

I get the following exception in my view, and it seems to be an axlsx problem. The line number in the error is invalid as the view file itself is only 25 lines long.

An ActionView::Template::Error occurred in competences#certificates_to_excel:

  undefined method `reopen' for "streamed":String
  app/views/cb/competences/certificates_to_excel.xlsx.axlsx:27:in `_app_views_cb_competences_certificates_to_excel_xlsx_axlsx___1718042271781105460_75871920'

When I grep the code, the only code where I find mentions of “reopen” or “streamed” are in rubyzip code and axlsx/axlsx_rails.

The problem is that I’m unable to duplicate this in my development environment. It only occurs in production, where the ruby and gem versions are the same.

I would like to use newer version of axlsx, but for some reason the gem always uses axlsx-1.3.6. How can I use the latest 2.0.1 version?

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 3
  • Comments: 28

Most upvoted comments

Just documenting here. Because this was the only google result I could find for this problem.

This problem appeared for me in Axlsx version 2.0.1 and RubyZip >= 1.1.1. Using RubyZip 1.1.0 solves the issue.

I realize this is a closed issue, but just want to report my findings as of Dec. 8, 2015. roo gem depends on rubyzip ~> 1.1 <= 2.0 axlsx 2.0.1 depends on rubyzip 1.0.0 However, towards the bottom of this issue from March 14, https://github.com/randym/axlsx/issues/328 a pre-release of 2.1 was released. Using gem 'axlsx', '2.1.0.pre' and gem axlsx_rails >=0.4 solves the compatibility conflict.

@Harpalsinh @harpalsinhrana @mariowise @workgena

If you look at the change log for Axlsx, Axlsx 2.0.0 pinned rubyzip at 0.9.9 for those who needed it. Axlsx 2.0.1 and up use rubyzip 1.x.x and above.

As of version 0.2.0 axlsx_rails requires Axlsx 2.0.1 or above. Changing to axlsx_rails 0.2.0 or above (0.4.0 is the latest version) should not cause any issues; there are a few breaking changes for borderline situations. Most of the changes from 1.5 to 2.0 had to do with Rails 4 changes. If you are using Rails 4.2, you will want axlsx_rails 0.4.0 or above. If you are still in Rails 3, axlsx_rails 1.5 should work just fine.

I will improve the Readme . I don’t think it is clear enough.