在我的申请中,有一些课程有步骤。 (用户通过按顺序查看步骤继续学习课程)
但是有很多类型的步骤(测验,文字,视频......等)。在这个例子中,我将展示其中两个步骤。
到目前为止,这是我的数据库/模型设计:
步骤
- ID
- step_type_id
- 的client_id
- 标题
- 摘要
- 位置
关系:
- belongs_to:client
- belongs_to:step_type
- has_one:step_quiz
- has_one step_text
step_quizzes
- ID
- step_id的数据类型
- 说明
- correct_to_pass
- retakes_allowed
- 的时限
关系:
- belongs_to:step
- has_many:quiz_questions
step_texts
关系:
之前有人向我建议这是一种多态关系,但我想我不知道它是怎么回事。我将其视为继承关系,其中子步骤类型从步骤表继承其基本信息。这可以用不同的方式建模吗?