railroady
railroady copied to clipboard
Hide inherited fields in rails model diagrams
@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
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 Would it help, if I would send you an archive of my test project? (A couple of "rails generate scaffold...", three model classes)
@RainerSchwarze accessible_attributes
method is deprecated in edge Rails If you can use alternative to it? cc/ @preston
@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 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.
For current projects this seems to be OBE. Ok to close?