Plugins - XHTML Content Type
Add to favoritesxhtml_content_type plugin for Rails
xhtml_content_type allows you to set the default MIME type for rendered .rhtml views to application/xhtml+xml if the client supports it, and only falling back to text/html for older clients.
For more information as to why this is good behavior, read this: http://hixie.ch/advocacy/xhtml
Installation
If your project is source-controlled by Subversion (which it should be, really), the easiest way to install this is via Rails’ plugin script:
./script/plugin install -x http://svn.codahale.com/xhtml_content_type
If you’re not using Subversion, or if you don’t want it adding svn:externals in your project, remove the -x switch:
./script/plugin install http://svn.codahale.com/xhtml_content_type
Alternatively, you can just check the trunk out from the repository, if you’re super-DIY.
cd path_to_rails_app cd vendor/plugins svn co http://svn.codahale.com/xhtml_content_type
Usage
xhtml_content_type is super easy to use. Add the method sends_xhtml_with_correct_content_type to a specific controller, or to ApplicationController to make all controllers send XHTML properly:
class ApplicationController < ActionController::Base
sends_xhtml_with_correct_content_type
end
sends_xhtml_with_correct_content_type also accepts standard filter-style conditions, if you need them:
class MySpecialController < ApplicationController
sends_xhtml_with_correct_content_type :except => [:seriously_weird_action]
end
class MyOtherSpecialController < ApplicationController
sends_xhtml_with_correct_content_type :only => [:the_only_regular_action]
end
You can also explicitly specify an XHTML content type using this plugin:
def xhtml_only_action
render :content_type => :xhtml
end
http://blog.codahale.com/2006/05/23/rails-plugin-xhtml_content_type/
http://svn.codahale.com/xhtml_content_type/
Rails' (MIT)
View Extensions

This plugin breaks the respond_to behaviour. When I deactivate JS on my firefox, the called block is wants.js, and if not present, I get an nil.call exception.