Skip to content

Commit 30aa19d

Browse files
committed
overcome arel bug on casting number fields value to 0
1 parent 54de2c9 commit 30aa19d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/ajax-datatables-rails/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def build_conditions_for(query)
120120
def search_condition(column, value)
121121
model, column = column.split('.')
122122
model = model.singularize.titleize.gsub( / /, '' ).gsub("/","::").constantize
123-
casted_column = ::Arel::Nodes::NamedFunction.new('CAST', [model.arel_table[column.to_sym].as('VARCHAR')])
123+
casted_column = ::Arel::Nodes::NamedFunction.new('CAST', [::Arel::Nodes::SqlLiteral.new(model.arel_table[column.to_sym].as('VARCHAR').to_sql)])
124124
casted_column.matches("%#{value}%")
125125
end
126126

0 commit comments

Comments
 (0)