Amit
Amit

Reputation: 3990

set content type header with rails and apache

I want to send a generated view as a kml file, with the necessary headers(content-type and file expires in)... the use of head gives a 500, and using response.headers has no effect...

What should i do?

Upvotes: 3

Views: 6759

Answers (2)

Syed Aslam
Syed Aslam

Reputation: 8807

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

Upvotes: 0

Andy Lindeman
Andy Lindeman

Reputation: 12165

Check out the :content_type option for render.

Upvotes: 11

Related Questions