5

I am writing a custom tag for Liquid and want to render a partial in the tag. I am assuming I have to use render_to_string but I can't seem to get it to work.

I've tried all sorts of things, including:

ActionController::Base.render_to_string(:partial => 'path/to/partial') 

But nothing seems to work. There has to be some easy way to do this that I'm missing.

Thanks in advance.

Matt
  • 61
  • 6

1 Answers1

4

The render_to_string method is an instance method:

ActionController::Base.new.send(:render_to_string,
                                :partial => 'path/to/partial')
Petrik de Heus
  • 970
  • 6
  • 9