{"action":"created","issue":{"url":"https://api.github.com/repos/cldwalker/hirb/issues/97","repository_url":"https://api.github.com/repos/cldwalker/hirb","labels_url":"https://api.github.com/repos/cldwalker/hirb/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/cldwalker/hirb/issues/97/comments","events_url":"https://api.github.com/repos/cldwalker/hirb/issues/97/events","html_url":"https://github.com/cldwalker/hirb/issues/97","id":131115390,"number":97,"title":"Specifying ActiveRecord descendents custom views","user":{"login":"joallard","id":949482,"avatar_url":"https://avatars.githubusercontent.com/u/949482?v=3","gravatar_id":"","url":"https://api.github.com/users/joallard","html_url":"https://github.com/joallard","followers_url":"https://api.github.com/users/joallard/followers","following_url":"https://api.github.com/users/joallard/following{/other_user}","gists_url":"https://api.github.com/users/joallard/gists{/gist_id}","starred_url":"https://api.github.com/users/joallard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joallard/subscriptions","organizations_url":"https://api.github.com/users/joallard/orgs","repos_url":"https://api.github.com/users/joallard/repos","events_url":"https://api.github.com/users/joallard/events{/privacy}","received_events_url":"https://api.github.com/users/joallard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-03T18:39:59Z","updated_at":"2016-02-03T18:40:16Z","closed_at":null,"body":"I have a lot of columns in my model.[1] I love Hirb. Now Hirb can't do all of its magic because I have too many columns. But let's face it, I don't want all the columns. I only want certain columns.\r\n\r\nI searched a bit in the docs, and tried the following:\r\n```\r\nHirb.add_dynamic_view(\"Wadget\", helper: :auto_table){ |o| {fields: [:id, :name, :token, :important_columns_only]} }\r\n```\r\n\r\nThough when I called my `Wadget.all`, this spec is still not activated as expected. I suspect it's because `ActiveRecord::Base` is there.\r\n\r\nI realize I'm probably expanding Hirb's scope a little by asking this, but this is something I think that's not unreasonable to provide, especially with the prevalence of AR.\r\n\r\nI'd like to add this to the wishlist: a way to indicate to Hirb fields I want (and this touches on #96 with fields one doesn't want). Ideally, this could be done in the config file, but I'll leave to the creator the liberty to say what he would accept.\r\n\r\nWhat I would propose is to either make what I tried work (either by having `add_dynamic_view` prepend the list in order of priority, or having Hirb choose a view by the most specific), or being able to specify this in YML config:\r\n\r\n```yml\r\nviews:\r\n  fields:\r\n    activerecord/base:\r\n      exclude:\r\n        - updated_at\r\n        - created_at\r\n        - secret_column\r\n    wadget:\r\n      only:\r\n        - id\r\n        - name\r\n        - important_stuff\r\n```\r\n\r\n[1]: (It's probably not the ideal structure, but it's an old application with a lot of legacy)"},"comment":{"url":"https://api.github.com/repos/cldwalker/hirb/issues/comments/179396634","html_url":"https://github.com/cldwalker/hirb/issues/97#issuecomment-179396634","issue_url":"https://api.github.com/repos/cldwalker/hirb/issues/97","id":179396634,"user":{"login":"cldwalker","id":11994,"avatar_url":"https://avatars.githubusercontent.com/u/11994?v=3","gravatar_id":"","url":"https://api.github.com/users/cldwalker","html_url":"https://github.com/cldwalker","followers_url":"https://api.github.com/users/cldwalker/followers","following_url":"https://api.github.com/users/cldwalker/following{/other_user}","gists_url":"https://api.github.com/users/cldwalker/gists{/gist_id}","starred_url":"https://api.github.com/users/cldwalker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cldwalker/subscriptions","organizations_url":"https://api.github.com/users/cldwalker/orgs","repos_url":"https://api.github.com/users/cldwalker/repos","events_url":"https://api.github.com/users/cldwalker/events{/privacy}","received_events_url":"https://api.github.com/users/cldwalker/received_events","type":"User","site_admin":false},"created_at":"2016-02-03T18:40:15Z","updated_at":"2016-02-03T18:40:15Z","body":"Thanks for reporting your issue! This is [one of my 13 active issues](https://gh-active-issues.herokuapp.com/#cldwalker/hirb#97). Use that link to check how soon your issue will be answered. Don't forget to check your issue against this project's CONTRIBUTING.md. Cheers."}}