我的过滤器
filter :club_id, :label => 'Club',
:as => :select,
:collection => Hash[Club.order(:city_id).includes(:city).map{|d| ["#{d.city.title}, #{d.address} - #{d.title}",d.id]}]
当我删除或创建一个俱乐部时,select in fiter的下拉列表仍然不会改变。显然它是缓存的。这仅在过滤器中发生。 如何禁用此缓存?
答案 0 :(得分:1)
尝试
filter :club_id, as: :select, collection: proc { Hash[Club.order(:city_id).includes(:city).map{|d| ["#{d.city.title}, #{d.address} - #{d.title}",d.id]}]}
HTH