1

I want to create a view to has_many model which will list all the answers to a topic. The relation between the question and answers is really simple, but everything else is getting too complex.

The user should have the option to add answers to questions and rate them like a simple poll app. Every Quiz is a collection of those answers Every Topic has a collection of quizzes about it

So how can I display all of the answers in each of the topics in a single view? Maybe should I create a table to this view and to collect the data in a background job?

Thanks in advanced!

    class Question < ActiveRecord::Base
    has_many :answers

class Answer < ActiveRecord::Base
    belongs_to :question
    belongs_to :quiz

class Quiz < ActiveRecord::Base
    has_many :answers
    belongs_to :topics, :through => :TopicQuiz
    belongs_to :users, :through => :UserQuiz
Sophia Gavish
  • 467
  • 2
  • 8
  • 16

0 Answers0