Given an HTTP Accept header and a set of available content types, this gem will tell you what to do.
Keith Rarick
gem "negotiator", "~> 0.1"