我查看了 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
其中代理机构_以前和代理机构将引用相同的代理机构模型。