preston / railroady

Ruby on Rails 3/4/5 model and controller UML class diagram generator. (`brew/port/apt-get install graphviz` before use!)
Other
1.71k stars 142 forks source link

Hide inherited fields in rails model diagrams #103

Open RainerSchwarze opened 8 years ago

RainerSchwarze commented 8 years ago

@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

preston commented 8 years ago

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.

RainerSchwarze commented 8 years ago

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

sandipransing commented 8 years ago

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

RainerSchwarze commented 8 years ago

@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?

sandipransing commented 8 years ago

@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.

preston commented 6 years ago

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