Fix for Rails 4.2

This PR came from https://github.com/rails-api/active_model_serializers/pull/620 .
This commit fixes the following error on Rails 4.2.0: https://github.com/emberjs/ember-rails/issues/408#issuecomment-66860483

I wish new version with this commit is released :pray: