Let's create an app that allows the user to create a course and different types of resources (document, video, quiz) . I am finding the best way to establish a relationship between a course and its resources for a difficult time.
Right now, I have:
class course & lt; AR :: Base is has_many: Document has has_many: Video has_many: quizzes end class document & lt; AR :: Base is_to: End of class video & lt; AR :: Base is_to: Courses end class quiz> AR :: Base is_to: Course end All the documents, videos and quizzes have some common features (for example, name, description) , But many features that are different I considered using STI and inherited them from a single class called "commands". I decided against this approach because I need many controllers for each class. I
Eventually, I want to be able to take action on all the resources related to a course so that all the documents, Videos, and together with the quiz list can be displayed as a sorted list.
Any suggestion about how to set this model to the best is that I can do it in two ways:
- Reverse Polymorphic Is_On Association (see)
- Multiple table succession (see)
IAA (IANS) MR rail noob is so IAC, which is the best approach to this situation, it is difficult to evaluate there is time. Any advice will be appreciated! In the end, I want to be able to take action on all such resources which are a curriculum.
Are related to, for example, list all the documents, videos, and quiz lists together and display them as a sorted list.
There is no way possible, but when I read this requirement, it seems that you will be the best with STI STI Rail is a basicly supported feature and you have a Only allows to query and manipulate various types of resources.
Comments
Post a Comment