Optimised region filter, to minimise db requests

This commit is contained in:
echarp 2018-07-14 16:20:15 +02:00
parent 98e803899c
commit 1bdd9f434f

View File

@ -18,10 +18,11 @@
= filter_region.name = filter_region.name
- if session[:region] == filter_region.id - if session[:region] == filter_region.id
%em.fa.fa-times %em.fa.fa-times
- elsif filter_region.regions.present? - elsif !filter_region.region && filter_region.regions.present?
%small %small
%em.fa.fa-chevron-down %em.fa.fa-chevron-down
%ul - unless filter_region.region
= render partial: '/regions/filter_region', %ul
collection: filter_region.regions = render partial: '/regions/filter_region',
collection: filter_region.regions