Class: Renalware::Letters::HtmlRenderer

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/letters/html_renderer.rb

Overview

Note we cannot use a partial layout with render_to_string as it will always expect the location to be in views/layouts and its not possible in Rails 5.1 to specify another or absolute path

Instance Method Summary collapse

Instance Method Details

#call(letter) ⇒ Object



9
10
11
12
13
14
15
16
# File 'app/models/renalware/letters/html_renderer.rb', line 9

def call(letter)
  context = LettersController.new
  context.render_to_string_with_wicked_pdf(
    partial: "/renalware/letters/formatted_letters/letter",
    locals: { letter: letter },
    encoding: "UTF-8"
  )
end