{"action":"created","issue":{"url":"https://api.github.com/repos/zendesk/stronger_parameters/issues/69","repository_url":"https://api.github.com/repos/zendesk/stronger_parameters","labels_url":"https://api.github.com/repos/zendesk/stronger_parameters/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/zendesk/stronger_parameters/issues/69/comments","events_url":"https://api.github.com/repos/zendesk/stronger_parameters/issues/69/events","html_url":"https://github.com/zendesk/stronger_parameters/issues/69","id":313693709,"number":69,"title":" Option to return params as strings. ","user":{"login":"bunufi","id":12247686,"avatar_url":"https://avatars1.githubusercontent.com/u/12247686?v=4","gravatar_id":"","url":"https://api.github.com/users/bunufi","html_url":"https://github.com/bunufi","followers_url":"https://api.github.com/users/bunufi/followers","following_url":"https://api.github.com/users/bunufi/following{/other_user}","gists_url":"https://api.github.com/users/bunufi/gists{/gist_id}","starred_url":"https://api.github.com/users/bunufi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bunufi/subscriptions","organizations_url":"https://api.github.com/users/bunufi/orgs","repos_url":"https://api.github.com/users/bunufi/repos","events_url":"https://api.github.com/users/bunufi/events{/privacy}","received_events_url":"https://api.github.com/users/bunufi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-12T11:52:11Z","updated_at":"2018-04-12T15:25:41Z","closed_at":null,"author_association":"NONE","body":"To start with, thanks for this gem. Really enjoy simplicity and the ability to use permit method on params for validations. \r\n\r\nCurrently I'm implementing Stronger Parameters in an existing API project that does not have any param validations. The project assumes that params object will return a set of strings, however stronger params casts the types. For this to work I have to convert every value back into the string. \r\n\r\nI do wonder what do you think about an option to get params back in strings. \r\nThis would be consistent with the fact that rails stores param values as strings. \r\n\r\n\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/zendesk/stronger_parameters/issues/comments/380845043","html_url":"https://github.com/zendesk/stronger_parameters/issues/69#issuecomment-380845043","issue_url":"https://api.github.com/repos/zendesk/stronger_parameters/issues/69","id":380845043,"user":{"login":"grosser","id":11367,"avatar_url":"https://avatars3.githubusercontent.com/u/11367?v=4","gravatar_id":"","url":"https://api.github.com/users/grosser","html_url":"https://github.com/grosser","followers_url":"https://api.github.com/users/grosser/followers","following_url":"https://api.github.com/users/grosser/following{/other_user}","gists_url":"https://api.github.com/users/grosser/gists{/gist_id}","starred_url":"https://api.github.com/users/grosser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grosser/subscriptions","organizations_url":"https://api.github.com/users/grosser/orgs","repos_url":"https://api.github.com/users/grosser/repos","events_url":"https://api.github.com/users/grosser/events{/privacy}","received_events_url":"https://api.github.com/users/grosser/received_events","type":"User","site_admin":false},"created_at":"2018-04-12T15:25:41Z","updated_at":"2018-04-12T15:25:41Z","author_association":"OWNER","body":"I'd rather not add that since it could be kinda confusing (in docs and in the docs) and is an edge-case ... I'd think what most users do is pass the params into AR objects and there string/object does not matter.\r\n\r\nSomething like this might do the trick ... but not sure if all .to_s produce exactly what was originally there:\r\n\r\n```\r\ndef stringify_values!(hash)\r\n  hash.each do |k, v|\r\n    if v.is_a?(Hash)\r\n      stringify_values!(v)\r\n    elsif v.is_a?(Array)\r\n      v.map! { |x| stringify_values!(x) }\r\n   else\r\n     hash[v] = k.to_s\r\n  end\r\n  hash\r\nend\r\n```\r\n\r\nmaybe as alternative keep a copy of the params and then call permit with just the keys ... either way it's going to be a it strange since stronger-parameters also does parsing when the original value was not strictly valid."}}
{"actor":{"display_login":"grosser"}}