我有以下代码
class Involvement < ActiveRecord::Base
belongs_to :matter
belongs_to :contact
end
class Contact < ActiveRecord::Base
has_many :involvements, :order => "position", :dependent => :destroy
has_many :matters, :through => :involvements, :source => :matter
end
class Matter < ActiveRecord::Base
has_many :involvements
has_many :plaintiffs, :through => :involvements, :source => :contact
has_many :defendants, :through => :involvements, :source => :contact
end
运行问题页面时出现错误。
ActiveRecord::HasManyThroughSourceAssociationNotFoundError in Matters#new
找不到源关联:模型参与中的联系人。尝试'has_many :plaintiffs, :through => :involvements, :source => '。它是其中之一吗?
在 rails 3.0.10 中升级 rails 2.3.11 项目时出现此错误,
它在 rails 2.3.11 中运行良好,但我无法理解为什么它会在 rails 3.0.10 中产生错误。
任何人都知道它的解决方案,或者为什么这会在rails 3.0.10中中断