活动管理员中的条件检查 table_for

Condition checking in active admin table_for

我有 2 tables 预购和付款与 has_many 关系,我想仅在检查状态(布尔)条件后显示 table 中的内容,我尝试了以下代码片段但它不起作用?如何检查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, :状态, :amount_in_dollars belongs_to :预购

预购型号 attr_accessible:姓名,:顺序 has_many:付款

我想根据状态在预购管理页面中显示付款详情。

试试下面的代码。希望有用。

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