diff --git a/app/services/params_to_query_service.rb b/app/services/params_to_query_service.rb index 6f8c0430eb00..f117459b7a6f 100644 --- a/app/services/params_to_query_service.rb +++ b/app/services/params_to_query_service.rb @@ -123,7 +123,9 @@ def set_query_class(query_class, model) else model_name = model.name - "#{model_name.demodulize}Query".constantize + # Some queries exist as Queries::Models::ModelQuery others as ModelQuery + "::Queries::#{model_name.pluralize}::#{model_name.demodulize}Query".safe_constantize || + "::#{model_name.demodulize}Query".constantize end end end