Jason Edgecombe
2006-Jul-31 20:09 UTC
[Rails] How do I call a controller from a model, console, or outside of rails?
Hi, I''m writing yet another cms and I need to capture the html output of a rendered template including helpers, etc from within my rails app. I plan to use backgroundrb, and I need to be able to capture the output of "pages.browse()" where pages is my controller. I need to pass in the id param. How can I do this besides using Net::HTTP? Using Net::HTTP hangs when I''m testing using webrick. I see that Actioncontroller::IntegrationTest can do this, but I have no idea of how to call that from a development/production environment. Thanks, Jason
Ezra Zygmuntowicz
2006-Jul-31 22:17 UTC
[Rails] How do I call a controller from a model, console, or outside of rails?
On Jul 31, 2006, at 1:08 PM, Jason Edgecombe wrote:> Hi, > > I''m writing yet another cms and I need to capture the html output > of a rendered template including helpers, etc from within my rails > app. I plan to use backgroundrb, and I need to be able to capture > the output of "pages.browse()" where pages is my controller. I need > to pass in the id param. > > How can I do this besides using Net::HTTP? Using Net::HTTP hangs > when I''m testing using webrick. > > I see that Actioncontroller::IntegrationTest can do this, but I > have no idea of how to call that from a development/production > environment. > > Thanks, > Jason > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/railsHey Jason- I think you can just use render_to_string to capture what you want. -Ezra