Skip to content

Commit

Permalink
Fix quoting issue on generate sql statements
Browse files Browse the repository at this point in the history
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 cerebris#1369
  • Loading branch information
MarcelEeken committed Nov 14, 2022
1 parent bf4b4cd commit 4807a11
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/jsonapi/active_relation_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {})
Expand Down

0 comments on commit 4807a11

Please sign in to comment.