You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to display the sides for my order_item's. (Order has_many order_items has_many Sides through OrderItemSides)
I'm trying in two ways: 1) Iteration 2) Table_for (since it is a collection of related resources)
For some reason, ActiveAdmin will display the raw objects at the end of the first column (i.e. #OrderItemSide:0x007fdc59a04be0).
Second column works but it creates a table inside my table.
Is this even possible in ActiveAdmin? I've looked everywhere!
panel "Order Details" do
table_for order.order_items, sortable: true, class: "product-order-table" do
order = Order.find(params[:id])
order_items = order.order_items
column "Sides" do |oi|
oi.order_item_sides.each do |ois|
ul do
li ois.side.name
end
end
end
column "Sides" do |oi|
table_for oi.order_item_sides do
column do |ois|
ul do
li ois.side.name
end
end
end
end
The text was updated successfully, but these errors were encountered:
column method of table_for is meant to render the result of the block it receives.
each statement return the last iterated item. That's way you are seeing that on the first example.
I notice you are rendering an ul and li for each side. So if you change that your problem goes away because ul just render html and doesn't return anything.
I meant to changing it this way:
column "Sides" do |oi|
ul do
oi.order_item_sides.each do |ois|
li ois.side.name
end
end
end
I'm trying to display the sides for my order_item's. (Order has_many order_items has_many Sides through OrderItemSides)
I'm trying in two ways: 1) Iteration 2) Table_for (since it is a collection of related resources)
For some reason, ActiveAdmin will display the raw objects at the end of the first column (i.e. #OrderItemSide:0x007fdc59a04be0).
Second column works but it creates a table inside my table.
Is this even possible in ActiveAdmin? I've looked everywhere!
The text was updated successfully, but these errors were encountered: