I have 2 tables preorder and payment with has_many relation, I want display the contents in table only after checking the status (boolean) condition, I tried with following code snippet but its not working? How to do check the condition inside the 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
Payment model attr_accessible :created_at, :payment_details, :status, :amount_in_dollars belongs_to :preorder
preorder model attr_accessible :name, :order has_many :payments
I want to display the payment details in preorder admin page based on status.
if a.statusinstead ofif a.status.nil?. - Arup Rakshit