2 options
1) you can use block inside column method
show do
panel "Items" do
table_for order.lines do
column :description
column :quantity do |line|
line.picklines.count #<-- you can access picklines for each line here
end
end
end
end
2) Try to use has_many :through
http://guides.rubyonrails.org/association_basics.html#the-has-many-through-association
The has_many :through
association is also useful for setting up "shortcuts" through nested has_many associations.
class Order < ActiveRecord::Base
has_many :lines, dependent: :destroy
has_many :picklines, through: :lines #<---- this line
accepts_nested_attributes_for :lines, allow_destroy: true
end
Than you can iterate over picklines
show do
panel "Picklines" do
table_for order.picklines do
column :description do |row|
row.line.description
end
column :quantity
end
end
end