railroady icon indicating copy to clipboard operation
railroady copied to clipboard

Hide inherited fields in rails model diagrams

Open RainerSchwarze opened this issue 9 years ago • 6 comments

@preston For a Rails project which uses Single Table Inheritance, I wanted to get rid of the superclasses' fields in subclasses in model diagrams. The only approach, which worked for me so far, was to look at the accessible attributes.

So if the option --show-only-accessible-attributes is set, the columns are filtered for the entries which are in current_class.accessible_attributes. A second option --hide-inherited-attributes removes all entries which are in the accessible_attributes of superclasses (until ActiveRecord::Base).

Can you take a look whether this sounds good enough to merge?

Thanks - Rainer

RainerSchwarze avatar Jan 20 '16 12:01 RainerSchwarze

Could someone that uses STI design chime in on how this impacts existing projects? I don't personally have any active projects designed this way, so am probably not the best person to make the call. If no one has any strong objections, though, it does make sense to me to merge in.

preston avatar Jan 21 '16 17:01 preston

@preston Would it help, if I would send you an archive of my test project? (A couple of "rails generate scaffold...", three model classes)

RainerSchwarze avatar Jan 21 '16 17:01 RainerSchwarze

@RainerSchwarze accessible_attributes method is deprecated in edge Rails If you can use alternative to it? cc/ @preston

sandipransing avatar Mar 14 '16 07:03 sandipransing

@sandipransing Rails is only in my "secondary" set of development environments so I don't have broad knowledge about it. Do you have a recommendation for an alternative?

RainerSchwarze avatar Mar 14 '16 08:03 RainerSchwarze

@RainerSchwarze Rails 4 now uses strong parameters and attribute protection is now performed at controller level so I'm not sure this PR is really needed for edge rails.

sandipransing avatar Mar 14 '16 10:03 sandipransing

For current projects this seems to be OBE. Ok to close?

preston avatar Apr 12 '18 18:04 preston