{"action":"created","issue":{"url":"https://api.github.com/repos/thoughtbot/administrate/issues/251","labels_url":"https://api.github.com/repos/thoughtbot/administrate/issues/251/labels{/name}","comments_url":"https://api.github.com/repos/thoughtbot/administrate/issues/251/comments","events_url":"https://api.github.com/repos/thoughtbot/administrate/issues/251/events","html_url":"https://github.com/thoughtbot/administrate/pull/251","id":117552900,"number":251,"title":"Display helpful message if attribute_name missing","user":{"login":"5minpause","id":84148,"avatar_url":"https://avatars.githubusercontent.com/u/84148?v=3","gravatar_id":"","url":"https://api.github.com/users/5minpause","html_url":"https://github.com/5minpause","followers_url":"https://api.github.com/users/5minpause/followers","following_url":"https://api.github.com/users/5minpause/following{/other_user}","gists_url":"https://api.github.com/users/5minpause/gists{/gist_id}","starred_url":"https://api.github.com/users/5minpause/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/5minpause/subscriptions","organizations_url":"https://api.github.com/users/5minpause/orgs","repos_url":"https://api.github.com/users/5minpause/repos","events_url":"https://api.github.com/users/5minpause/events{/privacy}","received_events_url":"https://api.github.com/users/5minpause/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/thoughtbot/administrate/milestones/2","html_url":"https://github.com/thoughtbot/administrate/milestones/v0.1.2","labels_url":"https://api.github.com/repos/thoughtbot/administrate/milestones/2/labels","id":1409138,"number":2,"title":"v0.1.2","description":"Bug fixes, compatibility improvements, documentation, and stability.","creator":{"login":"graysonwright","id":829576,"avatar_url":"https://avatars.githubusercontent.com/u/829576?v=3","gravatar_id":"","url":"https://api.github.com/users/graysonwright","html_url":"https://github.com/graysonwright","followers_url":"https://api.github.com/users/graysonwright/followers","following_url":"https://api.github.com/users/graysonwright/following{/other_user}","gists_url":"https://api.github.com/users/graysonwright/gists{/gist_id}","starred_url":"https://api.github.com/users/graysonwright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graysonwright/subscriptions","organizations_url":"https://api.github.com/users/graysonwright/orgs","repos_url":"https://api.github.com/users/graysonwright/repos","events_url":"https://api.github.com/users/graysonwright/events{/privacy}","received_events_url":"https://api.github.com/users/graysonwright/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":4,"state":"open","created_at":"2015-11-12T20:01:26Z","updated_at":"2015-11-18T17:19:19Z","due_on":"2015-11-21T08:00:00Z","closed_at":null},"comments":4,"created_at":"2015-11-18T10:03:37Z","updated_at":"2015-11-18T18:12:11Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/thoughtbot/administrate/pulls/251","html_url":"https://github.com/thoughtbot/administrate/pull/251","diff_url":"https://github.com/thoughtbot/administrate/pull/251.diff","patch_url":"https://github.com/thoughtbot/administrate/pull/251.patch"},"body":"# Problem\r\nIf a field in `COLLECTION_ATTRIBUTES` has no key in `ATTRIBUTE_TYPES` either because I misspelled it or I forget to add it to `ATTRIBUTE_TYPES` I will get a undefined method new for `nil:NilClass` in `Page::Base`\r\n\r\n# Solution\r\nDon't access hash values directly but use `fetch`. If the attribute is not found the block raises an error with a helpful error message.\r\n\r\nCloses #246"},"comment":{"url":"https://api.github.com/repos/thoughtbot/administrate/issues/comments/157806180","html_url":"https://github.com/thoughtbot/administrate/pull/251#issuecomment-157806180","issue_url":"https://api.github.com/repos/thoughtbot/administrate/issues/251","id":157806180,"user":{"login":"monkbroc","id":1919681,"avatar_url":"https://avatars.githubusercontent.com/u/1919681?v=3","gravatar_id":"","url":"https://api.github.com/users/monkbroc","html_url":"https://github.com/monkbroc","followers_url":"https://api.github.com/users/monkbroc/followers","following_url":"https://api.github.com/users/monkbroc/following{/other_user}","gists_url":"https://api.github.com/users/monkbroc/gists{/gist_id}","starred_url":"https://api.github.com/users/monkbroc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monkbroc/subscriptions","organizations_url":"https://api.github.com/users/monkbroc/orgs","repos_url":"https://api.github.com/users/monkbroc/repos","events_url":"https://api.github.com/users/monkbroc/events{/privacy}","received_events_url":"https://api.github.com/users/monkbroc/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T18:12:11Z","updated_at":"2015-11-18T18:12:11Z","body":"After looking at this more, it seems that the concern of attributes existing in a dashboard belongs in the dashboard class (surprise!).\r\n\r\nIt's easier to test the behavior there.\r\n\r\nMy change also decreases the knowledge collaborators like page classes have to know about the internals of the dashboard class (`attribute_types` is a hash I can use `fetch` and `slice` on).\r\n\r\nRegarding Hound: have you thought of making your line length a little longer? 80 seems rather short for Ruby. I've had better luck with 90 or 100."}}