rails-api/active_model_serializers — pull request #717 by greshny (2014-11-05 15:19:55+00:00)
Title: fixed issue with rendering Hash which appears in rails 4.2.0.beta4

Unfortunately it fails in example application:

`Gemfile`:

```ruby
source 'https://rubygems.org'

gem 'rails', '4.2.0.beta4'
gem 'pg'
gem 'sass-rails', '5.0.0.beta1'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'

gem 'sdoc', '~> 0.4.0', group: :doc
gem 'active_model_serializers', github: 'rails-api/active_model_serializers', branch: '0-9-stable'

group :development, :test do
gem 'rspec-rails', '~> 2.14.0'
gem 'factory_girl_rails', '~> 4.2.1'
end
```

`app/controllers/application_controller.rb`:

```ruby
class ApplicationController < ActionController::Base
# skipped...
rescue_from ActiveRecord::RecordNotFound do |exception|
respond_to do |f|
f.json { render json: {message: I18n.t('not_found')}, status: 404 }
end
end
# skipped....
end
```

`app/controllers/articles_controller.rb`:

```ruby
class ArticlesController < ApplicationController
# skipped...
def show
@article = Article.find params[:id]
render status: 200, json: @article
end
# skipped...
end
```

`spec/requests/articles_spec.rb`

```ruby
require 'spec_helper'

describe 'Articles API' do
describe 'GET /articles/:id.json' do
it 'returns proper json (status 404)' do
get article_path(id: 100500, format: :json)
json = JSON.parse response.body
expect(response).to_not be_success
expect(json['message']).to eq I18n.t('not_found')
end
end
end
```