Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

render_to_string in lib class not working

Tags:

I'm trying to use delayed_job to update a remote database via xml

In my lib folder I put a file with a class that should do a render_to_text with template.xml.builder, but I get:

undefined method `render_to_string' for #<SyncJob:0x7faf4e6c0480>... 

What am I doing wrong?

like image 277
Arwed Avatar asked Apr 20 '10 19:04

Arwed


2 Answers

ac = ActionController::Base.new() ac.render_to_string(:partial => '/path/to/your/template', :locals => {:varable => somevarable}) 
like image 122
ataer81 Avatar answered Oct 20 '22 17:10

ataer81


I had problems with a undefined helper method then I used ApplicationController

ApplicationController.new.render_to_string 
like image 38
Germano Avatar answered Oct 20 '22 19:10

Germano