prawn-rails icon indicating copy to clipboard operation
prawn-rails copied to clipboard

Support for render renderable

Open Spone opened this issue 1 year ago • 3 comments

Rails now supports rendering objects with:

class InvoiceDocument < Prawn::Document
  def initialize
    # prawn code to render the document
  end
end

class InvoicesController
  def show
    render renderable: InvoiceDocument.new
  end
end

Could prawn-rails implement support for this? Prawn::Document would need to respond to #render_in and #format.

Spone avatar Feb 11 '25 14:02 Spone

We don't define Prawn::Document in this gem, that class is defined by the prawn gem

We could however add these methods to PrawnRails::Document

westonganger avatar Feb 11 '25 15:02 westonganger

Definitely! I think it makes more sense to include this to this gem rather than prawn. Would you accept a PR for this?

Spone avatar Feb 11 '25 16:02 Spone

Yes would love a PR.

westonganger avatar Feb 11 '25 21:02 westonganger