0
我试图找出如何显示比一个层次更深的关联。显示页面,显示协会
显示在我的形式,我只是做了它那里:
form do |f|
f.inputs "Details" do
f.input :name
f.input :item_category
f.input :resource
f.input :status
end
f.inputs "Actions" do
f.semantic_errors *f.object.errors.keys
f.has_many :item_actions, :allow_destroy => true, :heading => 'Planets', :new_record => true do |obj|
obj.input :action
obj.input :status
obj.input :_destroy, :as=>:boolean, :required => false, :label=>'Remove'
obj.has_many :item_action_skills, :heading => "Skills" do |ias|
ias.input :skill
ias.input :level
end
end
end
f.actions
末
你可以看到,我展示的has_many:item_actions和去更深一层到item_action.item_action_skills。在这种形式是完美的作品。
现在我想要在展示页面上。我的代码:
show do |obj|
attributes_table do
row :name
row :item_category
row(:resource) {|obj| status_tag((obj.resource ? 'yes' : 'no'), (obj.resource ? :ok : :error))}
row(:status) {|obj| status_tag(obj.status_string.first, obj.status_string.last) }
end
panel "Actions" do
table_for obj.item_actions do
column :action
column(:status) {|obj| status_tag(obj.status_string.first, obj.status_string.last) }
end
end
active_admin_comments
末
我写table_for,但现在该怎么去下一个协会? 我想要item_action.item_action_skills。
我不知道。任何想法?
谢谢!
的Ruby 1.9.3 Rails的3.2.14 ActiveAdmin 0.6.0
谢谢,这就是看起来非常好! –