Override Controller Response

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