Forum: Ruby on Rails Using render_to_string in other custom classes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Duncan Ponting (Guest)
on 2006-04-20 20:25
(Received via mailing list)
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
This topic is locked and can not be replied to.