Netzke的三个模型之间的关联

时间:2012-10-05 07:50:33

标签: ruby-on-rails-3.2 netzke

我有3个型号:Machine,Mouse,KeyBoard这些是关联的。

class Machine
  has_many: mouses
  has_many: keyboards
end

class Mouse
  belongs_to: machine
end

class KeyBoard
  belongs_to: machine
end

这些协会工作正常。

但是,我想通过OneToManyExplorer

在netzke中显示三个网格
class MachineExplorer < Netzke::Communitypack::OneToManyExplorer
title "Machines"
 title "Machines"
 container_config class_name: "MachineGrid",
                   region: :north,
                   height: 200,
                   width: 150
 collection_config class_name: "MachineKeyBoardGrid", 
                   region: :east,
                   height: 200,
                   width: 100,
                   split: true                

 collection_config class_name: "MachineMouseGrid",
                   region: :center,
                   height: 200,
                   width: 150

end

但它只显示两个网格。 MachineGridMachineMouseGrid。我也希望MachineKeyBoardGrid

1 个答案:

答案 0 :(得分:0)

您需要使用以下教程作为参考自己实现它: https://github.com/netzke/netzke/wiki/Building-a-composite-component