diff --git a/app/models/form/setup/questions/location_id.rb b/app/models/form/setup/questions/location_id.rb index ccdf97097..fc6e421e1 100644 --- a/app/models/form/setup/questions/location_id.rb +++ b/app/models/form/setup/questions/location_id.rb @@ -22,8 +22,8 @@ class Form::Setup::Questions::LocationId < ::Form::Question def displayed_answer_options(case_log) return {} unless case_log.scheme - scheme_location_ids = Location.where(scheme_id: case_log.scheme.id).map(&:id).map(&:to_s) - answer_options.select { |k, _v| scheme_location_ids.include?(k) } + scheme_location_ids = case_log.scheme.locations.pluck(:id) + answer_options.select { |k, _v| scheme_location_ids.include?(k.to_i) } end def hidden_in_check_answers?(case_log, _current_user = nil)