From 4807a118af1ffcb0761a9a548d7b7819196926cc Mon Sep 17 00:00:00 2001 From: Marcel Eeken Date: Mon, 14 Nov 2022 15:38:59 +0100 Subject: [PATCH] Fix quoting issue on generate sql statements Using the previous method to generate the quote string could lead to incorrect sql statement where double quotes were used for select statements in MySql. By using the `quote_table_name` function from Rails, the correct quoting mechnism will be automatically used for the specific database. Fixes #1369 --- lib/jsonapi/active_relation_resource.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jsonapi/active_relation_resource.rb b/lib/jsonapi/active_relation_resource.rb index c8631172..a353ab4e 100644 --- a/lib/jsonapi/active_relation_resource.rb +++ b/lib/jsonapi/active_relation_resource.rb @@ -845,7 +845,7 @@ def alias_table_field(table, field, quoted = false) end def quote(field) - "\"#{field.to_s}\"" + ActiveRecord::Base.connection.quote_table_name(field) end def apply_filters(records, filters, options = {})