我有三种型号。
class Location < ActiveRecord::Base
attr_accessible :description
belongs_to :user
has_many :zones
has_many :iteractions, :through => :zones
end
class Zone < ActiveRecord::Base
attr_accessible :description
belongs_to :location
has_many :iteractions
end
class Iteraction < ActiveRecord::Base
attr_accessible :count, :itime
belongs_to :zone
belongs_to :location, :through => :zone
end
所以我尝试安装rails_admin 对我说“未知密钥:通过(参数错误)”
错误在哪里?
答案 0 :(得分:3)
belongs_to
关联不能有:through
选项。相反,您可以使用has_one :location, :through => :zone