# Problems when calling rendering a template from a cron job

**URL:** <https://www.ruby-forum.com/t/problems-when-calling-rendering-a-template-from-a-cron-job/128393>\
**Category:** Rails\
**Created:** [February 7, 2008, 10:15am UTC](https://www.ruby-forum.com/t/problems-when-calling-rendering-a-template-from-a-cron-job/128393 "2008-02-07T10:15:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kusako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b4bc9f/32.png) [@kusako](https://www.ruby-forum.com/u/kusako)\
**Post date:** [February 7, 2008, 10:15am UTC](https://www.ruby-forum.com/t/problems-when-calling-rendering-a-template-from-a-cron-job/128393/1 "2008-02-07T10:15:00Z")

</div>

Hi,

I am trying to use a cron job to render and mail pdf files on a daily  
basis. Problem is that this code doesn’t compile and render the  
template; it just passes the embedded ruby code on as text.

app = ActionView::Base.new  
app.controller = ActionController::Base.new  
data = app.render\_template(‘rhtml’, “path\_to\_template/template.rhtml”)  
pdf \<\< data

Reason that I use render\_template is that render\_to\_string, which I  
originally used, is a protected method… and if I try to bypass that  
with send, I get a null pointer exception.

Cheers  
/Markus
