Use Rails format routing to match the RubyGems API

A previous version of this commit broke bundler because
the controller was responding with JSON at unexpected
times.  Hitting the dependencies endpoint in a browser
returned marshalled Ruby objects, but hitting that
endpoint with curl returned JSON.

To fix that issue, this commit reverses the order of
format checks so that the dependencies endpoint responds
with marshalled Ruby objects when the response format is
ambiguous.