{"action":"created","issue":{"url":"https://api.github.com/repos/ruby-grape/grape-entity/issues/223","repository_url":"https://api.github.com/repos/ruby-grape/grape-entity","labels_url":"https://api.github.com/repos/ruby-grape/grape-entity/issues/223/labels{/name}","comments_url":"https://api.github.com/repos/ruby-grape/grape-entity/issues/223/comments","events_url":"https://api.github.com/repos/ruby-grape/grape-entity/issues/223/events","html_url":"https://github.com/ruby-grape/grape-entity/issues/223","id":157490241,"number":223,"title":"Grape::Entity::Delegator::HashObject fails when extracting string keys","user":{"login":"tom-mayer","id":2562379,"avatar_url":"https://avatars.githubusercontent.com/u/2562379?v=3","gravatar_id":"","url":"https://api.github.com/users/tom-mayer","html_url":"https://github.com/tom-mayer","followers_url":"https://api.github.com/users/tom-mayer/followers","following_url":"https://api.github.com/users/tom-mayer/following{/other_user}","gists_url":"https://api.github.com/users/tom-mayer/gists{/gist_id}","starred_url":"https://api.github.com/users/tom-mayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tom-mayer/subscriptions","organizations_url":"https://api.github.com/users/tom-mayer/orgs","repos_url":"https://api.github.com/users/tom-mayer/repos","events_url":"https://api.github.com/users/tom-mayer/events{/privacy}","received_events_url":"https://api.github.com/users/tom-mayer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-30T12:06:25Z","updated_at":"2016-05-30T13:27:58Z","closed_at":null,"body":"Hi,\r\n\r\nI was trying to present a hash of values with a grape entity. The keys in the hash were strings and I got null values all over the place as a response.\r\n\r\nIt boils down to Grape::Entity::Delegator::HashObject, when it tries to render the attribute it only tries to extract the attribute with a symbol as a key and not a string. \r\n\r\n![screen shot 2016-05-30 at 13 50 29](https://cloud.githubusercontent.com/assets/2562379/15649123/5bab16ec-266f-11e6-808f-67cfa549959e.png)\r\n\r\nI think a simple \r\n`object[attribute] || object[attributeto_s]`\r\nwould fix the issue, although I'm not sure whether you need to make the destinction between symbols and strings there for other reasons. For now I simple convert all my keys to symbols before handing them to grape entity. But in any case would be more convenient the other way around.\r\n\r\nCheers \r\nTom"},"comment":{"url":"https://api.github.com/repos/ruby-grape/grape-entity/issues/comments/222492720","html_url":"https://github.com/ruby-grape/grape-entity/issues/223#issuecomment-222492720","issue_url":"https://api.github.com/repos/ruby-grape/grape-entity/issues/223","id":222492720,"user":{"login":"dblock","id":542335,"avatar_url":"https://avatars.githubusercontent.com/u/542335?v=3","gravatar_id":"","url":"https://api.github.com/users/dblock","html_url":"https://github.com/dblock","followers_url":"https://api.github.com/users/dblock/followers","following_url":"https://api.github.com/users/dblock/following{/other_user}","gists_url":"https://api.github.com/users/dblock/gists{/gist_id}","starred_url":"https://api.github.com/users/dblock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dblock/subscriptions","organizations_url":"https://api.github.com/users/dblock/orgs","repos_url":"https://api.github.com/users/dblock/repos","events_url":"https://api.github.com/users/dblock/events{/privacy}","received_events_url":"https://api.github.com/users/dblock/received_events","type":"User","site_admin":false},"created_at":"2016-05-30T13:27:58Z","updated_at":"2016-05-30T13:27:58Z","body":"Treating hash keys indifferently is probably a good idea, but I wouldn't just change it. Start by writing some specs around this and then see whether this change has an impact on other existing tests?"}}
{"actor":{"display_login":"dblock"}}