I've got a model "Window" with has_many relationship to another model "WindowItems". The WindowItems has a self referencing relationship (so it can have nested children of itself).
I've got an activeadmin resource for window like this:
show :title => :name do
attributes_table do
row :name
row :column_position
row :window_type
row :column_count
row :active
row :page_position
row :collapsible
row :icon_id
row :created_at
row :updated_at
end
div :class => "accordion" do
if window.window_items.count > 0
panel "Window Items (#{window.window_items.count})" do
table_for window.window_items do
column "Name" do |a|
link_to a.name, admin_window_item_path(a.id)
end
column :active
column :link
column :icon
column :window
end
end
end
end # end accordion
end
So right now, this is showing all window items, but instead I would only like it to show the parent window items (leaving the child window items off).
How can I filter the records that are shown on the panel "window items do" block?
Thanks