This project is archived and is in readonly mode.
render_to_string in mailer causes subsequent render to fail
-
bhu
- Tag changed from actioncontroller, actionmailer to actioncontroller, actionmailer, rendering
think i got the same error
def cancellation(contract, user) @contract = contract kit = PDFKit.new(render_to_string('pdf/cancellation', :layout => false)) kit.stylesheets << 'private/stylesheets/cancellation.css' attachments['Cancellation.pdf'] = kit.to_pdf options = {} options[:to] = contract.email options[:from] = user.email options[:bcc] = user.email if Variable.send_employee_email_bcc options[:subject] = "Cancellation" mail options endit renders nothing except the attachment which breaks the mail completely if there is no body.
the format block helps getting around this but i dont think that it's intended for this kind of situation
mail options do |format| format.text format.html endwith this block the default behavior is some kind of restored. you have to explicitly specify every format. per real default rails is auto detecting which formats are available.
Sorry for not really having a solution, just a workaround :/
