我有2个表预订和使用has_many关系付款,我想在检查状态(布尔)条件后才显示表中的内容,我尝试使用下面的代码片段,但它不起作用?如何检查table_for中的条件?
panel "payment" do
table_for preorder.payments do |a|
if a.status.nil?
column "Received On", :created_at
column "Details & Notes", :payment_details
column "Amount", :amount_in_dollars
end
end
end
付款方式 attr_accessible:created_at,:payment_details,:status,:amount_in_dollars belongs_to:preorder
预购模式 attr_accessible:name,:order has_many:付款
我想根据状态在预订管理页面中显示付款详情。
答案 0 :(得分:1)
尝试以下代码。我希望它有效。
panel "payment" do
table_for preorder.payments do |a|
unless a.blank?
if a.status
column "Received On", :created_at
column "Details & Notes", :payment_details
column "Amount", :amount_in_dollars
end
end
end
end