ruby - Rails: Refactoring for Single Table Inheritance to follow DRY principles? -


i creating learning management system, admins can create curriculums , assign users. curriculum has_many courses, , users mark courses complete.

now, want extend feature , add document model, admin can upload document , assign users. users have come platform , mark document completed, similar how interact courses.

i know should have started off model such assignablematerial , made curriculums , document inherit assignablematerial, didn't think adding documents. best way add documents , still use "assign" feature curriculum, , "mark complete" feature course?

could document inherit curriculums, or either have move methods tied curriculums/courses parent model assignablematerial, , inherit document parent model?

probably best strategy extract common features of document , curriculum "concern" -- document , curriculum remain separate classes inheriting directly activerecord::base, separate tables in database, common behavior between them live in single module both include.

see question overview: how use concerns in rails 4


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -