rendering OUTSIDE request

Hello,

I need to render erb template WITH LAYOUT OUTSIDE REQUEST, for example to generate document in background process.

How can I do this? I know that I can do ActionView::Base.new ... but its possible to have also layout?

Code w/o layout support:

def return_string_to_me_baby

    x = ActionView::Base.new(['app/views'])      # assign template variables     assigns.each do |k,v|       x.assigns[k] = v     end     x.render template

end

Thanks!

one more time :slight_smile:

def return_string_to_me_baby(template, assigns={})

    x = ActionView::Base.new(['app/views'])      # assign template variables     assigns.each do |k,v|       x.assigns[k] = v     end     x.render template

end

Quoting Frantisek Psotka <rails-mailing-list@andreas-s.net>:

If there is somenthing like "render_to_string" - that you can use only in controller.

You can use wget in a cronjob to invoke a controller request/method. If none of your users are on the same box, use local_request? method to block invocation by other means. Or use some other method of authentication/authorization.

HTH,   Jeffrey

P.S. local_request? checks for 127.0.0.1 request IP address.

NICE IDEA, thanks! if i use this approach, it will also break other limitations/inconsistenties.

anyways, if someone knows, how to add layout-rendering capability (yield stuff) to my/your own code, i'am very curious

Jeffrey L. Taylor wrote: