I have a Lesson model that contains about 50 fields that all reference a Grade model. The grades model has a simple list 0-8 that is used as a lessons graded value.
Is there a way to avoid filling up my model with 50 lines of:
belongs_to :walking, :class => 'Grade'
belongs_to :running, :class => 'Grade'
belongs_to :crawling, :class => 'Grade'
...
postgres database
You could do this:
That will at least save you from having to write all the lines out, but you still need to list the names of the associations (walking, running, crawling, etc.) for it to work (as I’ve indicated above).