rails 3.0.10中的ActiveRecord :: HasManyThroughSourceAssociationNotFoundError

时间:2012-05-17 12:21:23

标签: ruby-on-rails rails-3.0.10

我有以下代码

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#new

无法找到源关联:联系模型参与。试试'has_many:plaintiffs,:through =&gt; :涉及,:source =&gt; ”。它是其中之一吗?

我在rails 3.0.10中升级rails 2.3.11项目时遇到此错误,

它在rails 2.3.11中工作正常,但我无法理解为什么它会在rails 3.0.10中产生错误。

任何人都知道它的解决方案,或者说明为什么这会在rails 3.0.10中破坏

1 个答案:

答案 0 :(得分:0)

我得到了它的解决方案,实际上在我的模型中act_as_modified插件正在使用...

因为它在rails 3.0.10中弃用它会给我错误,当我删除它时,所有关联工作正常......