On 10/12/06, Caleb
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> I have a website completed and am now looking into providing services
> for the data the site uses. What would be nice is if I could somehow
> override the template parsing and output and instead render and return
> an XML request (as defined by a different set of templates that I will
> create). I don''t want to just cut and paste all of the logic and
error
> handling that gets pulled when retrieving the data from the database.
> What I want to do is run the code in the controller actions but then
> just intercept any rhtml rendering and instead render XML templates? Is
> there a graceful way to do this without duplicating controller code?
>
> --
You probably want to look at respond_to.
respond_to do |wants|
wants.html do
... render html ...
end
wants.xml do
... render xml ...
end
There are a few tutorials/examples around as well.
Cheers,
Max
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---