{"action":"opened","issue":{"url":"https://api.github.com/repos/ruby-grape/grape-roar/issues/16","labels_url":"https://api.github.com/repos/ruby-grape/grape-roar/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/ruby-grape/grape-roar/issues/16/comments","events_url":"https://api.github.com/repos/ruby-grape/grape-roar/issues/16/events","html_url":"https://github.com/ruby-grape/grape-roar/issues/16","id":118695511,"number":16,"title":"Telling a representer to represent nil adds all of that class's methods to nil","user":{"login":"j-clark","id":1175272,"avatar_url":"https://avatars.githubusercontent.com/u/1175272?v=3","gravatar_id":"","url":"https://api.github.com/users/j-clark","html_url":"https://github.com/j-clark","followers_url":"https://api.github.com/users/j-clark/followers","following_url":"https://api.github.com/users/j-clark/following{/other_user}","gists_url":"https://api.github.com/users/j-clark/gists{/gist_id}","starred_url":"https://api.github.com/users/j-clark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j-clark/subscriptions","organizations_url":"https://api.github.com/users/j-clark/orgs","repos_url":"https://api.github.com/users/j-clark/repos","events_url":"https://api.github.com/users/j-clark/events{/privacy}","received_events_url":"https://api.github.com/users/j-clark/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-24T20:23:55Z","updated_at":"2015-11-24T20:23:55Z","closed_at":null,"body":"The code causing this behavior is https://github.com/ruby-grape/grape-roar/blob/master/lib/grape/roar/representer.rb#L10\r\n\r\nExample\r\n```ruby\r\nuser = User.find_by(email: 'i_dont_exist@gmail.com')\r\n# user => nil\r\npresent user, with: User::Representer\r\n# User::Representer.ancestors => [..., Grape::Roar::Representer, ...]\r\n```\r\n\r\nObviously there's a bug in this application code, but the result is that, since `nil` is a singleton, now every time the application asks for `nil`, it gets it, but with all kinds of fun stuff mixed in, like a custom `#to_hash` that, for instance, mucks with the instantiation of `ActionController::Parameters` and causes completely unrelated pages in an app to blow up\r\n\r\nThoughts? I'd be happy to submit a PR, but i only have a cursory understanding of all the interplay between grape, roar, grape-roar, representable, etc. and just tossing in a `nil` check might not be the best approach"}}