{"action":"created","issue":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1893","repository_url":"https://api.github.com/repos/rails-api/active_model_serializers","labels_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1893/labels{/name}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1893/comments","events_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1893/events","html_url":"https://github.com/rails-api/active_model_serializers/issues/1893","id":173616811,"number":1893,"title":"Unable to render hash","user":{"login":"dnlsandiego","id":8008023,"avatar_url":"https://avatars.githubusercontent.com/u/8008023?v=3","gravatar_id":"","url":"https://api.github.com/users/dnlsandiego","html_url":"https://github.com/dnlsandiego","followers_url":"https://api.github.com/users/dnlsandiego/followers","following_url":"https://api.github.com/users/dnlsandiego/following{/other_user}","gists_url":"https://api.github.com/users/dnlsandiego/gists{/gist_id}","starred_url":"https://api.github.com/users/dnlsandiego/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnlsandiego/subscriptions","organizations_url":"https://api.github.com/users/dnlsandiego/orgs","repos_url":"https://api.github.com/users/dnlsandiego/repos","events_url":"https://api.github.com/users/dnlsandiego/events{/privacy}","received_events_url":"https://api.github.com/users/dnlsandiego/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-08-27T21:39:12Z","updated_at":"2016-08-31T05:32:18Z","closed_at":"2016-08-31T03:39:43Z","body":"I have a Rails 5 app in API mode using this gem and [devise_token_auth](https://github.com/lynndylanhurley/devise_token_auth) for token based authentication. `devise_token_auth`'s controllers renders plain hashes as responses but neither of all the 3 adapters seem to be able to render the hashes to JSON.\r\n\r\n#### Expected behavior vs actual behavior\r\n`curl -i -X DELETE http://localhost:3000/v1/auth/sign_out`\r\n\r\nExpected response:\r\n`{  errors: ['User was not found or was not logged in.'] }`\r\n\r\nActual response (with the default adapter):\r\n`{}`\r\n\r\nWith the `:json_api` adapter:\r\n```NoMethodError (undefined method `read_attribute_for_serialization' for {:errors=>[\"User was not found or was not logged in.\"]}:Hash)```\r\n\r\nWith the `:json` adapter:\r\n`NoMethodError (undefined method `model_name' for Hash:Class):` \r\n\r\n#### The`devise_token_auth` destroy method\r\n```ruby\r\ndef render_destroy_error\r\n  render json: {\r\n    errors: [I18n.t(\"devise_token_auth.sessions.user_not_found\")]\r\n  }, status: 404\r\nend\r\n```\r\n\r\n#### Steps to reproduce\r\nA fresh Rails 5 app in API mode with `active_model_serializers` version `0.10.0` and `devise_token_auth` version `0.1.37` gems.\r\nI can provide a repo to reproduce this issue if needed but I feel like there is something I'm missing in usage of this gem.\r\n\r\nIs rendering plain hashes supported in this gem? I tried looking through the docs, issues, and SO for answers but found nothing.\r\n\r\nIs there a way to set active_model_serializer to allow rendering of hashes directly?"},"comment":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/comments/243662750","html_url":"https://github.com/rails-api/active_model_serializers/issues/1893#issuecomment-243662750","issue_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1893","id":243662750,"user":{"login":"bf4","id":142914,"avatar_url":"https://avatars.githubusercontent.com/u/142914?v=3","gravatar_id":"","url":"https://api.github.com/users/bf4","html_url":"https://github.com/bf4","followers_url":"https://api.github.com/users/bf4/followers","following_url":"https://api.github.com/users/bf4/following{/other_user}","gists_url":"https://api.github.com/users/bf4/gists{/gist_id}","starred_url":"https://api.github.com/users/bf4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bf4/subscriptions","organizations_url":"https://api.github.com/users/bf4/orgs","repos_url":"https://api.github.com/users/bf4/repos","events_url":"https://api.github.com/users/bf4/events{/privacy}","received_events_url":"https://api.github.com/users/bf4/received_events","type":"User","site_admin":false},"created_at":"2016-08-31T05:32:18Z","updated_at":"2016-08-31T05:32:18Z","body":"@dnlsandiego It not a custom serializer per-se, it's that a Hash is not the kind of object AMS is meant to take as input. It expects a model.  AMS can handle virtual and dynamic attributes, so that might be a better way to add your special logic."}}
{"actor":{"display_login":"bf4"}}