{"action":"created","issue":{"url":"https://api.github.com/repos/lotus/controller/issues/70","labels_url":"https://api.github.com/repos/lotus/controller/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/lotus/controller/issues/70/comments","events_url":"https://api.github.com/repos/lotus/controller/issues/70/events","html_url":"https://github.com/lotus/controller/issues/70","id":53991707,"number":70,"title":"Lotus::Action::Params should deep symbolise keys of itself","user":{"login":"joneslee85","id":135605,"avatar_url":"https://avatars.githubusercontent.com/u/135605?v=3","gravatar_id":"","url":"https://api.github.com/users/joneslee85","html_url":"https://github.com/joneslee85","followers_url":"https://api.github.com/users/joneslee85/followers","following_url":"https://api.github.com/users/joneslee85/following{/other_user}","gists_url":"https://api.github.com/users/joneslee85/gists{/gist_id}","starred_url":"https://api.github.com/users/joneslee85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joneslee85/subscriptions","organizations_url":"https://api.github.com/users/joneslee85/orgs","repos_url":"https://api.github.com/users/joneslee85/repos","events_url":"https://api.github.com/users/joneslee85/events{/privacy}","received_events_url":"https://api.github.com/users/joneslee85/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lotus/controller/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/lotus/controller/labels/discussion","name":"discussion","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-11T13:26:50Z","updated_at":"2015-01-12T08:39:27Z","closed_at":null,"body":"I posted following nested params to a controller action:\r\n\r\n```\r\n\"user\" => { \"first_name\" => \"Sean\", \"last_name\" => \"Bean\" }\r\n```\r\n\r\nThe controller has access to `params` which is instance of `Lotus::Utils::Attributes`. It works fine with 1 level hash, but with nested level hash, it turns out to be not the case. Let's see this example:\r\n\r\n```\r\nparams['user'] #=>  { \"first_name\" => \"Sean\", \"last_name\" => \"Bean\" }\r\nparams[:user] #=>  { \"first_name\" => \"Sean\", \"last_name\" => \"Bean\" }\r\n# => wot? I would expect { first_name: \"Sean\", last_name: \"Bean\" }\r\n```\r\n\r\n**UPDATE**: it seems to be this is an issue of `Lotus::Utils::Attributes`, which is lotus/utils. But I want to bring up a discussion here whether we should provide indifferent access to our params hash or not. I don't find indifferent access hash has any particular merits aside of convenient way to access hash. I'd vote for a string hash."},"comment":{"url":"https://api.github.com/repos/lotus/controller/issues/comments/69540809","html_url":"https://github.com/lotus/controller/issues/70#issuecomment-69540809","issue_url":"https://api.github.com/repos/lotus/controller/issues/70","id":69540809,"user":{"login":"AlfonsoUceda","id":925961,"avatar_url":"https://avatars.githubusercontent.com/u/925961?v=3","gravatar_id":"","url":"https://api.github.com/users/AlfonsoUceda","html_url":"https://github.com/AlfonsoUceda","followers_url":"https://api.github.com/users/AlfonsoUceda/followers","following_url":"https://api.github.com/users/AlfonsoUceda/following{/other_user}","gists_url":"https://api.github.com/users/AlfonsoUceda/gists{/gist_id}","starred_url":"https://api.github.com/users/AlfonsoUceda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlfonsoUceda/subscriptions","organizations_url":"https://api.github.com/users/AlfonsoUceda/orgs","repos_url":"https://api.github.com/users/AlfonsoUceda/repos","events_url":"https://api.github.com/users/AlfonsoUceda/events{/privacy}","received_events_url":"https://api.github.com/users/AlfonsoUceda/received_events","type":"User","site_admin":false},"created_at":"2015-01-12T08:39:27Z","updated_at":"2015-01-12T08:39:27Z","body":"I think this behaviour is correct:\r\n```\r\nparams['user'] #=>  { \"first_name\" => \"Sean\", \"last_name\" => \"Bean\" }\r\nparams['user'].class #=>  Lotus::Utils::Hash\r\nparams[:user] #=>  { \"first_name\" => \"Sean\", \"last_name\" => \"Bean\" }\r\nparams[:user].class #=>  Lotus::Utils::Hash\r\n```\r\nand this behaviour I think it isn't supported now because the class returned is Utils::Hash and it isn't a Utils::Attributes:\r\n```\r\nparams['user']['first_name'] #=>  \"Sean\"\r\nparams[:user][:first_name] #=>  \"Sean\"\r\n```\r\n\r\nI think in Utils::Attributes we should create Utils::Attributes instances for deeped hashes\r\n\r\n```\r\nparams['user'] #=>  { \"first_name\" => \"Sean\", \"last_name\" => \"Bean\" }\r\nparams['user'].class #=>  Lotus::Utils::Attributes\r\nparams[:user] #=>  { \"first_name\" => \"Sean\", \"last_name\" => \"Bean\" }\r\nparams[:user].class #=>  Lotus::Utils::Attributes\r\n```"}}