Restful output different file format


I see the in the Resful Rails, it default support the output format of the controller action is html, rjs, xml ....etc. And xml can generate from defineing a xml format in the rxml file. But how to define the output format that the rails is not support in default? Such as if i need to define the output to CSV format. I need to register the Mime in environment.rb, but how to define the template for outputing the file in csv format like using rxml to output file in xml format?

Thank~~~ Patrick