如何清除或禁用activeadmin过滤器中的缓存选择?

时间:2014-04-09 14:14:41

标签: caching ruby-on-rails-4 filter activeadmin

我的过滤器

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的下拉列表仍然不会改变。显然它是缓存的。这仅在过滤器中发生。 如何禁用此缓存?

1 个答案:

答案 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