标签云

微信群

扫码加入我们

WeChat QR Code

I have a Comment model in my app with many comment_typesclass Comment < ActiveRecord::Basebelongs_to :comment_type, :polymorphic => trueendAlso I have a public QA system. So for every pair I have a modelclass QA < ActiveRecord::Basehas_one :question, :class_name => :comment, :as => :comment_type, :autosave => truehas_one :asnwer, :class_name => :comment, :as => :comment_type, :autosave => trueendAnd this seems a little overuse for me to have a special table for QA model. Because this table should have only ID key. So is there a better solution? Or maybe something wrong with my architecture in total?


possible duplicate of ActiveRecord::Base Without Table

2019年04月22日13分58秒

seems like I've found a solution. Sorry for this.

2019年04月22日13分58秒

The main feature (if it can be called so) of QA system in my app is to have only one question and one answer. So this solution is not for me, but thank you.

2019年04月22日13分58秒