We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Console error:
irb(main):002> enrollment.save_diploma User Load (3.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] /Users/miguel/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/turbo-rails-1.5.0/app/controllers/turbo/frames/frame_request.rb:36:in `turbo_frame_request_id': Could not render layout: undefined method `headers' for nil:NilClass (NoMethodError) request.headers["Turbo-Frame"] ^^^^^^^^ /Users/miguel/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/turbo-rails-1.5.0/app/controllers/turbo/frames/frame_request.rb:36:in `turbo_frame_request_id': undefined method `headers' for nil:NilClass (NoMethodError) request.headers["Turbo-Frame"]
Method:
def save_pdf template, locals, orientation: "portrait", page_size: "Letter" name = template.split("/").last pdf_file = WickedPdf.new.pdf_from_string( ActionController::Base.new.render_to_string( template: "pdfs/#{template}", locals: locals, encoding: "UTF-8" ), pdf: to_s, page_size: page_size, orientation: orientation, margin: {top: 0, bottom: 0, left: 0, right: 0} ) tempfile = Tempfile.new([name, ".pdf"], Rails.root.join("tmp")) tempfile.binmode tempfile.write pdf_file tempfile.close if pdf_file.present? update "#{name}": tempfile tempfile.unlink end end
MacOS Sonoma 14.2 wicked_pdf (2.6.3) wkhtmltopdf 0.12.6 (with patched qt)
Showing the file is ok, but trying to save the file with Carrierwave return this error
The text was updated successfully, but these errors were encountered:
You maybe able to work around this by using the ApplicationController renderer. This worked in my example.
ApplicationController
Change your render_to_string to this:
render_to_string
ApplicationController.renderer.render( template: "pdfs/#{template}", locals: locals, encoding: "UTF-8" )
Hope this helps!
Sorry, something went wrong.
No branches or pull requests
Console error:
Method:
MacOS Sonoma 14.2
wicked_pdf (2.6.3)
wkhtmltopdf 0.12.6 (with patched qt)
Showing the file is ok, but trying to save the file with Carrierwave return this error
The text was updated successfully, but these errors were encountered: