You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
I searched a bit in the docs, and tried the following:
Though when I called my Wadget.all, this spec is still not activated as expected. I suspect it's because ActiveRecord::Base is there.
I 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.
I'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.
What 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:
views:
fields:
activerecord/base:
exclude:
- updated_at
- created_at
- secret_columnwadget:
only:
- id
- name
- important_stuff
[1]: (It's probably not the ideal structure, but it's an old application with a lot of legacy)
The text was updated successfully, but these errors were encountered:
Thanks for reporting your issue! This is one of my 13 active issues. 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.
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.
I searched a bit in the docs, and tried the following:
Though when I called my
Wadget.all
, this spec is still not activated as expected. I suspect it's becauseActiveRecord::Base
is there.I 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.
I'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.
What 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:[1]: (It's probably not the ideal structure, but it's an old application with a lot of legacy)
The text was updated successfully, but these errors were encountered: