Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SystemStackError when app also uses the okcomputer gem #827

Open
BlakeWard opened this issue Apr 18, 2019 · 3 comments
Open

SystemStackError when app also uses the okcomputer gem #827

BlakeWard opened this issue Apr 18, 2019 · 3 comments

Comments

@BlakeWard
Copy link

Issue description

If your Rails (in my case Rails 4.2.11) app also uses the okcomputer gem, then you'll get a SystemStackError when trying to visit the /okcomputer url. Works fine with version 1.1.0 of wicked_pdf.

Expected or desired behavior

Should be able to use okcomputer gem as well as wicked_pdf

System specifications

wicked_pdf gem version (output of cat Gemfile.lock | grep wicked_pdf):
Problem occurs with wicked_pdf 1.2.0, 1.2.1 and 1.2.2

wkhtmltopdf version (output of wkhtmltopdf --version):

whtmltopdf provider gem and version if one is used:

platform/distribution and version (e.g. Windows 10 / Ubuntu 16.04 / Heroku cedar):

@aualdrich
Copy link

@BlakeWard I wonder if this is related to #823 I'm also having this issue where I'm trying to override ActionController::Base's render method by using Module#prepend but because of the aliasing done by WickedPDF for render, it's hitting a stack overflow error.

@unixmonkey
Copy link
Collaborator

Yes, I think that's related. Both gems mess with render.

It's planned for WickedPdf 2.0 to define a renderer with the Rails renderers.add method or a base wicked_pdf(options) method you can call from the controller, instead of messing with render itself.

I'd like it to first be opt-in to deprecate the override and bridge compatibility to a 2.0 release, where we drop the alias/prepend code altogether.

I've been pretty busy lately though, so I'd love it if you or someone else reading this could help me out.

@ditsara
Copy link

ditsara commented Jul 4, 2019

If it helps, here's the hack I'm currently using to get around this problem:

  def render_without_wicked_pdf(*options, &block)
    m = method(:render)
    until m.nil? || m.owner == ActionController::Rendering
      m = m.super_method
    end
    m&.(*options, &block)
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants