{"action":"created","issue":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1745","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/1745/labels{/name}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1745/comments","events_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1745/events","html_url":"https://github.com/rails-api/active_model_serializers/issues/1745","id":156130120,"number":1745,"title":"Empty collection rendering with incorrect root","user":{"login":"mockdeep","id":80543,"avatar_url":"https://avatars.githubusercontent.com/u/80543?v=3","gravatar_id":"","url":"https://api.github.com/users/mockdeep","html_url":"https://github.com/mockdeep","followers_url":"https://api.github.com/users/mockdeep/followers","following_url":"https://api.github.com/users/mockdeep/following{/other_user}","gists_url":"https://api.github.com/users/mockdeep/gists{/gist_id}","starred_url":"https://api.github.com/users/mockdeep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mockdeep/subscriptions","organizations_url":"https://api.github.com/users/mockdeep/orgs","repos_url":"https://api.github.com/users/mockdeep/repos","events_url":"https://api.github.com/users/mockdeep/events{/privacy}","received_events_url":"https://api.github.com/users/mockdeep/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails-api/active_model_serializers/labels/C:%20Question","name":"C: Question","color":"d4c5f9"},{"url":"https://api.github.com/repos/rails-api/active_model_serializers/labels/S:%20Ready%20for%20PR","name":"S: Ready for PR","color":"009800"},{"url":"https://api.github.com/repos/rails-api/active_model_serializers/labels/V:%200.10.x","name":"V: 0.10.x","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-05-22T01:38:11Z","updated_at":"2016-06-01T07:14:22Z","closed_at":null,"body":"#### Expected behavior vs actual behavior\r\n\r\nWhen I upgraded to AMS 0.10.0, a started seeing this issue. When an empty collection is rendered within a controller, the wrong root key is transmitted to the client side. I get:\r\n\r\n```\r\n{\"\":[]}\r\n```\r\n\r\nwhen I expect:\r\n\r\n```\r\n{\"tasks\":[]}\r\n```\r\n\r\nI have a tasks controller that looks like the following. In this case it's returning an empty array, not an ActiveRecord::Relation object:\r\n\r\n```ruby\r\nclass TasksController < ApplicationController\r\n  def index\r\n    respond_to do |format|\r\n      format.json { render json: current_user.undone_and_pending_tasks }\r\n    end\r\n  end\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/comments/222912003","html_url":"https://github.com/rails-api/active_model_serializers/issues/1745#issuecomment-222912003","issue_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1745","id":222912003,"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-06-01T07:14:22Z","updated_at":"2016-06-01T07:14:22Z","body":"@ehannes See resolution of what I think is a duplicate in https://github.com/rails-api/active_model_serializers/issues/1756#issuecomment-222570499"}}
{"actor":{"display_login":"bf4"}}