Try
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
Вопрос
My filter
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]}]
When I delete or create a club, the drop-down list of select in fiter still does not change. Apparently it is cached. This occurs only in the filters. How do I disable this cache?
Решение
Try
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