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!
--
Posted via http://www.ruby-forum.com/.
one more time :)
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
--
Posted via http://www.ruby-forum.com/.
If there is somenthing like "render_to_string" - that you can use only in controller. -- Posted via http://www.ruby-forum.com/.
Quoting Frantisek Psotka <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > 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:> Quoting Frantisek Psotka <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>: >> >> 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.-- Posted via http://www.ruby-forum.com/.