File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
app/services/forest_liana Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -81,11 +81,15 @@ def parse_condition(condition)
8181 parsed_field = parse_field_name ( field )
8282 parsed_operator = parse_operator ( operator )
8383 parsed_value = parse_value ( operator , value )
84+ field_and_operator = "#{ parsed_field } #{ parsed_operator } "
8485
85- if Rails ::VERSION ::MAJOR >= 5
86- ActiveRecord ::Base . sanitize_sql ( [ "#{ parsed_field } #{ parsed_operator } ?" , parsed_value ] )
86+ if Rails ::VERSION ::MAJOR < 5
87+ "#{ field_and_operator } #{ ActiveRecord ::Base . sanitize ( parsed_value ) } "
88+ # NOTICE: sanitize method as been removed in Rails 5.1 and sanitize_sql introduced in Rails 5.2.
89+ elsif Rails ::VERSION ::MAJOR == 5 && Rails ::VERSION ::MINOR == 1
90+ "#{ field_and_operator } #{ ActiveRecord ::Base . connection . quote ( parsed_value ) } "
8791 else
88- " #{ parsed_field } #{ parsed_operator } #{ ActiveRecord ::Base . sanitize ( parsed_value ) } "
92+ ActiveRecord ::Base . sanitize_sql ( [ " #{ field_and_operator } ?" , parsed_value ] )
8993 end
9094 end
9195
You can’t perform that action at this time.
0 commit comments