Using render_to_string in other custom classes


#1

I have a project where I’m publishing files. Once when the user
clicks publish via a URL and one when an email is received that tells
the app they want to publish again. Because the publishing requires
templates I have them in there own views. The problem is when I want
to publish via email I don’t want to ask the controller to render the
views.

This is what I tried to do:

#/lib/myclass.rb

class foo
def build
@rts = ActionController::Base.new
file_x
file_y
end

def file_x
contents = @rts.render_to_string( path_to_my_template, self )
# and then I’d make the file etc
end

def file_y
contents = @rts.render_to_string( path_to_my_template, self )
# and then I’d make the file etc
end
end

the problem is that render_to_string is protected. Anyone know how I
can get around this?

–Duncan