{"action":"created","issue":{"url":"https://api.github.com/repos/svenfuchs/i18n/issues/250","labels_url":"https://api.github.com/repos/svenfuchs/i18n/issues/250/labels{/name}","comments_url":"https://api.github.com/repos/svenfuchs/i18n/issues/250/comments","events_url":"https://api.github.com/repos/svenfuchs/i18n/issues/250/events","html_url":"https://github.com/svenfuchs/i18n/pull/250","id":31375943,"number":250,"title":"Maintain subclasses of Hash when calling Hash#slice","user":{"login":"jimmycuadra","id":122457,"avatar_url":"https://avatars.githubusercontent.com/u/122457?v=3","gravatar_id":"","url":"https://api.github.com/users/jimmycuadra","html_url":"https://github.com/jimmycuadra","followers_url":"https://api.github.com/users/jimmycuadra/followers","following_url":"https://api.github.com/users/jimmycuadra/following{/other_user}","gists_url":"https://api.github.com/users/jimmycuadra/gists{/gist_id}","starred_url":"https://api.github.com/users/jimmycuadra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimmycuadra/subscriptions","organizations_url":"https://api.github.com/users/jimmycuadra/orgs","repos_url":"https://api.github.com/users/jimmycuadra/repos","events_url":"https://api.github.com/users/jimmycuadra/events{/privacy}","received_events_url":"https://api.github.com/users/jimmycuadra/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-04-12T04:11:05Z","updated_at":"2015-01-11T07:47:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/svenfuchs/i18n/pulls/250","html_url":"https://github.com/svenfuchs/i18n/pull/250","diff_url":"https://github.com/svenfuchs/i18n/pull/250.diff","patch_url":"https://github.com/svenfuchs/i18n/pull/250.patch"},"body":"This patch corrects i18n's implementation of `Hash#slice` so that it always returns an object of the same class it was originally called on.\r\n\r\nIn the current implementation, it creates a new hash, copies the selected key/value pairs into it, and returns it. This causes the returned value to be a different class, in the case where the original object was a subclass of Hash. This behavior is problematic when using something like `Hashie` or `HashWithIndifferentAccess`, because translation string interpolation only works for symbols, and keys can be copied into the new hash as strings, depending on the implementation of the subclass.\r\n\r\nI discovered this in another library that returns `Hashie::Rash` objects, which work like allow symbol and string key access, but when copied by i18n's `Hash#slice`, lose their ability to look up values by symbol keys."},"comment":{"url":"https://api.github.com/repos/svenfuchs/i18n/issues/comments/69486531","html_url":"https://github.com/svenfuchs/i18n/pull/250#issuecomment-69486531","issue_url":"https://api.github.com/repos/svenfuchs/i18n/issues/250","id":69486531,"user":{"login":"jimmycuadra","id":122457,"avatar_url":"https://avatars.githubusercontent.com/u/122457?v=3","gravatar_id":"","url":"https://api.github.com/users/jimmycuadra","html_url":"https://github.com/jimmycuadra","followers_url":"https://api.github.com/users/jimmycuadra/followers","following_url":"https://api.github.com/users/jimmycuadra/following{/other_user}","gists_url":"https://api.github.com/users/jimmycuadra/gists{/gist_id}","starred_url":"https://api.github.com/users/jimmycuadra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimmycuadra/subscriptions","organizations_url":"https://api.github.com/users/jimmycuadra/orgs","repos_url":"https://api.github.com/users/jimmycuadra/repos","events_url":"https://api.github.com/users/jimmycuadra/events{/privacy}","received_events_url":"https://api.github.com/users/jimmycuadra/received_events","type":"User","site_admin":false},"created_at":"2015-01-11T07:47:16Z","updated_at":"2015-01-11T07:47:16Z","body":"The library I was referring to is [rmoriz/digital_ocean](https://github.com/rmoriz/digital_ocean), which does not involve Rails."}}