0
我有我的應用程序評論模型與許多comment_types沒有遷移的模型。 Rails的
class Comment < ActiveRecord::Base
belongs_to :comment_type, :polymorphic => true
end
我也有一個公共的質量保證體系。因此,對於每一對我有一個模型
class QA < ActiveRecord::Base
has_one :question, :class_name => :comment, :as => :comment_type, :autosave => true
has_one :asnwer, :class_name => :comment, :as => :comment_type, :autosave => true
end
,這似乎有點過度使用對我來說,有質量保證模式的特殊表。因爲這個表應該只有ID鍵。那麼有沒有更好的解決方案?或者我的架構總共可能有問題?
[ActiveRecord :: Base Without Table]的可能重複(http://stackoverflow.com/questions/937429/activerecordbase-without-table) – Ximik 2012-02-08 20:01:27
好像我找到了解決方案。非常遺憾。 – Ximik 2012-02-08 20:02:04