File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
lib/ajax-datatables-rails Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 11module AjaxDatatablesRails
22 class Base
33 extend Forwardable
4+ include ActiveRecord ::Sanitization ::ClassMethods
45 class MethodNotImplementedError < StandardError ; end
56
67 attr_reader :view , :options , :sortable_columns , :searchable_columns
@@ -126,15 +127,15 @@ def new_search_condition(column, value)
126127 model , column = column . split ( '.' )
127128 model = model . constantize
128129 casted_column = ::Arel ::Nodes ::NamedFunction . new ( 'CAST' , [ model . arel_table [ column . to_sym ] . as ( typecast ) ] )
129- casted_column . matches ( "%#{ value } %" )
130+ casted_column . matches ( "%#{ sanitize_sql_like ( value ) } %" )
130131 end
131132
132133 def deprecated_search_condition ( column , value )
133134 model , column = column . split ( '.' )
134135 model = model . singularize . titleize . gsub ( / / , '' ) . constantize
135136
136137 casted_column = ::Arel ::Nodes ::NamedFunction . new ( 'CAST' , [ model . arel_table [ column . to_sym ] . as ( typecast ) ] )
137- casted_column . matches ( "%#{ value } %" )
138+ casted_column . matches ( "%#{ sanitize_sql_like ( value ) } %" )
138139 end
139140
140141 def aggregate_query
You can’t perform that action at this time.
0 commit comments