If you add routing for a resource:
ActionController::Routing::Routes.draw do |map|
map.resources :maps
end
And register additional mime-types:
Mime::Type.register 'application/vnd.google-earth.kml+xml', :kml
You don't need a respond_to
block in your controller to serve these additional types. Instead, just create views for the specific types, for example 'show.kml.builder'
or 'index.kml.erb'
. Rails will render these type-specific templates when requests for '/maps.kml'
or '/maps/1.kml'
are received, setting the response type appropriately.