File tree Expand file tree Collapse file tree 4 files changed +8
-4
lines changed Expand file tree Collapse file tree 4 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 11PATH
22 remote: .
33 specs:
4- query_helper (0.3.9 )
4+ query_helper (0.4.0 )
55 activerecord (> 5 )
66 activesupport (> 5 )
77 sqlite3
Original file line number Diff line number Diff line change @@ -18,7 +18,9 @@ def update(sql)
1818
1919 def remove_comments
2020 # Remove SQL inline comments (/* */) and line comments (--)
21- @sql = @sql . gsub ( /\/ \* (.*?)\* \/ / , '' ) . gsub ( /--(.*)$/ , '' )
21+ @sql = @sql . gsub ( %r{/\* [^/]*?\* /}m , '' ) # Removes multi-line comments (/* ... */)
22+ . gsub ( /--[^\n ]*/ , '' ) # Removes single-line comments (--)
23+
2224 @sql . squish!
2325 end
2426
@@ -186,7 +188,7 @@ def find_aliases
186188 ColumnMap . new (
187189 alias_name : sql_alias ,
188190 sql_expression : sql_expression . squish ,
189- aggregate : /(array_agg|avg|bit_and|bit_or|bool_and|bool_or|boolor_agg|booland_agg|count|every|json_agg|jsonb_agg|json_object_agg|jsonb_object_agg|max|min|string_agg|sum|xmlagg)\( (.*)\) / . match? ( sql_expression )
191+ aggregate : /\b (array_agg|avg|bit_and|bit_or|bool_and|bool_or|boolor_agg|booland_agg|count|every|json_agg|jsonb_agg|json_object_agg|jsonb_object_agg|max|min|string_agg|sum|xmlagg)\( (.*)\) / . match? ( sql_expression )
190192 ) if sql_alias
191193 end
192194 column_maps . compact
Original file line number Diff line number Diff line change 11class QueryHelper
2- VERSION = "0.3.9 "
2+ VERSION = "0.4.0 "
33end
Original file line number Diff line number Diff line change 44class ApplicationController < ActionController ::API
55 include Rails . application . routes . url_helpers
66 include QueryHelper ::QueryHelperConcern
7+ include ActionController ::RequestForgeryProtection
78 before_action :create_query_helper
9+ protect_from_forgery with : :exception
810end
911
1012class ParentsController < ApplicationController
You can’t perform that action at this time.
0 commit comments