0

我查看了 Google、Rails_Admin dox 等,但找不到答案。

我有一家模特经纪公司:

class Agency < ActiveRecord::Base
    has_and_belongs_to_many :kids

还有儿童模型:

class Kid < ActiveRecord::Base
    has_and_belongs_to_many :agencies
    attr_accessible :agency_ids

在 Rails_Admin 中,我使用以下代码访问代理:

config.model Kid do
    edit do
      field :agencies
    end
end

但是,对于我的生活,我无法弄清楚如何与不同领域的同一模型建立关联。就像是:

config.model Kid do
    edit do
      field :agencies
      field :agencies_previous      
    end
end

其中代理机构_以前和代理机构将引用相同的代理机构模型。

4

1 回答 1

0

我认为您需要的是类似https://github.com/benedikt/mongoid-tree的东西,您可以在其中引用自我模型,这就是您所需要的吗?

于 2012-11-13T15:54:59.360 回答