From what I read, ActiveAdmin will automatically get a partial path based on the current model / resource name. This means that passing "child_list" will result in
"/admin/process_nodes/_child_list.html.erb" .
Use will be
div render "child_list", :locals { :parent => process_node }
Also, it seems like it would be better to include the unless in the unless panel pane. Then you do not have to add an unnecessary rendering call if there are no subprocesses.
panel "Children - SubProcesses" do text_node link_to "New", new_admin_sub_process_node_path(:parent_id => process_node.id) unless parent.children.empty? div render "child_list", :locals { :parent => process_node } end end
Finally, I do not know if using partial benefits is a big benefit. I do not know if you have anything else in partial, but you can write it like this.
panel "Children - SubProcesses" do text_node link_to "New", new_admin_sub_process_node_path(:parent_id => process_node.id) unless parent.children.empty? table_for parent.children do column :id column :name column "Actions" do |child_node| text_node link_to "View", admin_process_node_path(child_node) text_node " " text_node link_to "Edit", edit_admin_process_node_path(child_node) text_node " " text_node link_to "Delete", admin_process_node_path(child_node), :method => :delete, :confirm => "Delete?" end end end end
Baylor rae '
source share