app/helpers/calendar_helper.rb in kit_cms-2.3.16 vs app/helpers/calendar_helper.rb in kit_cms-2.3.17
- old
+ new
@@ -166,11 +166,13 @@
def regions_list
last_region_id = nil
first = true
op = "{ "
+ at_least_one = false
Subregion.order("regions.name, subregions.name").includes(:region).each do |sr|
+ at_least_one = true
if sr.region_id != last_region_id
if !first
op += "],\r\n"
else
first = false
@@ -178,10 +180,11 @@
last_region_id = sr.region_id
op += "#{sr.region_id} : ["
end
op += "[ \"#{sr.name}\", #{sr.id} ], "
end
- op += "]}"
+ op += "]" if at_least_one
+ op += "}"
return op.html_safe
end