Hi, The application use only rhtml files, but now I want to generate xml. The controllers will be the same, only what will change will the rhtml to rxml, how I use the same code of the controller to the controller that generate xml? What I do to use tha same function, but one time with rhtml and in others cases with rxm?? Thank''s -- Pedro C. Valentini pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org +55 (21) 8708-8035
> The application use only rhtml files, but now I want to generate xml. > The controllers will be the same, only what will change will the rhtml > to rxml, how I use the same code of the controller to the controller > that generate xml? > What I do to use tha same function, but one time with rhtml and in > others cases with rxm??Try having the controller action call render(:action => ''action_xml'') or render(:action => ''action_html'') depending on if you want XML or not. If you''re not running off the latest and greatest rails, render_action() should work fine. -- rick http://techno-weenie.net
Pedro Valentini
2005-Jun-20 19:52 UTC
Re: How generate xml with the same code of html pages?
Somethink like ??? def action if @params[''xml''] render(:action => ''action_xml'') else render(:action => ''action_html'') end end Rick Olson escreveu:>>The application use only rhtml files, but now I want to generate xml. >>The controllers will be the same, only what will change will the rhtml >>to rxml, how I use the same code of the controller to the controller >>that generate xml? >>What I do to use tha same function, but one time with rhtml and in >>others cases with rxm?? >> >> > >Try having the controller action call render(:action => ''action_xml'') >or render(:action => ''action_html'') depending on if you want XML or >not. If you''re not running off the latest and greatest rails, >render_action() should work fine. > > >-- Pedro C. Valentini pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org +55 (21) 8708-8035 _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Pedro Valentini
2005-Jun-20 20:09 UTC
Re: How generate xml with the same code of html pages?
I found render :template "path/template" but it found only .rhtml files, can I set to render rxml files??? Thank you Rick Olson escreveu:>>The application use only rhtml files, but now I want to generate xml. >>The controllers will be the same, only what will change will the rhtml >>to rxml, how I use the same code of the controller to the controller >>that generate xml? >>What I do to use tha same function, but one time with rhtml and in >>others cases with rxm?? >> >> > >Try having the controller action call render(:action => ''action_xml'') >or render(:action => ''action_html'') depending on if you want XML or >not. If you''re not running off the latest and greatest rails, >render_action() should work fine. > > >-- Pedro C. Valentini pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org +55 (21) 8708-8035 _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails