0
我想建立一组关系,看起来像下面的代码 主要的事情,我认为我的问题是在SomethingThatNeedsAnAnswer类,我想与多态模型的关系使用名称是超过它的类名不同Mongoid复杂多态关系
Class Votable
has_many :votes
belongs_to :question, polymorphic: true
end
Class Vote
belongs_to :selected_answer, polymorphic: true
belongs_to :votable
end
Class SomethingThatNeedsAFewAnswers
has_one :some_question, class_name: "Votable", as :question
has_one :some_other_question, class_name: "Votable", as :question
end
Class ExampleAnswerClass
field :some_text_field
has_many: votes: as :selected_answers
end
预先感谢任何帮助