我有一个像这样的 table_for:
ActiveAdmin.register_page "Reports" do
menu priority: 2, label: I18n.t('active_admin.reports')
content title: I18n.t("active_admin.reports") do
columns do
column do
panel I18n.t('active_admin.bookings') do
paginated_collection(Booking.where("date BETWEEN ? AND ?",(params[:date_first].nil? or params[:date_first].empty? ? "2013-01-01" : params[:date_first]),(params[:date_last].nil? or params[:date_last].empty? ? Time.new.strftime("%Y-%m-%d").to_s : params[:date_last])).order('created_at DESC').page(params[:page]).per(15)) do
table_for collection do |booking|
column('Date') { |b| b.date }
column('Id') { |b| b.id }
column('Name') { |b| b.captain.nil? ? '' : b.captain.name }
column('Gender') { |b| b.captain.nil? ? '' : b.captain.gender }
column("Age") { |b| b.captain.nil? ? '' : b.captain.age }
column('Age min') { |b| b.captain.nil? ? '' : b.captain.age_min }
column('Age max') { |b| b.captain.nil? ? '' : b.captain.age_max }
column('Note') { |b| b.captain.nil? ? '' : b.captain.note }
column('Religion') { |b| b.captain.nil? ? '' : b.captain.religion }
column('Religionsens') { |b| b.captain.nil? ? '' : b.captain.religionsens }
column('Smeeting ID') { |b| b.smeeting.nil? ? '' : b.smeeting.id }
column('Paiement') { |b| BookingPayment.where(booking_id:b.id).sum(:type_cd) }
column('Amis') { |b| BookingPayment.where("booking_id=? AND profile_id!=?", b.id, b.owner_id).count}
end
end
end
end
end
end
end
我想允许使用“created_at”字段对此表进行过滤。Defaults_action 标签不起作用,也不能过滤:
你有什么想法?