Single Table Inheritance (STI) column associations
问题 When using single table inheritance does one have to be careful not to populate the columns which are specific to different models? Is there a way to specify which columns each model uses? 回答1: As far as Rails is concerned, every column can be set in every subclass. You can add logic to your subclass models to prevent certain fields from being set, but there's no automated way to do so. You could probably implement it has a before_save filter. class MySubModel < MyModel UNUSED_FIELDS = %w{