Update to Rails 4.0.4
Update Rails.
Add middlewares.
Refactor to use respond_with.