set content type header with rails and apache
You'd need to register the KML mime type. In your config/initializers/mime_types.rb
Mime::Type.register "application/vnd.google-earth.kml", :kml
Then in your action you can do:
format.kml { ... }
KML Tutorial: http://code.google.com/apis/kml/documentation/kml_tut.html#kml_server