How to return a custom mime type from a Rails application

Add the new mime type to the respective rails initializer

echo "Mime::Type.register \"application/xhtml+xml\", :xhtml" \
  > config/initializers/mime_types.rb

Use the name of this mime type in the config/routes.rb

map.root :controller => "test", :action => 'view', :format => 'xhtml'
Tags: