43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/active_scaffold/finder.rb', line 43
def create_conditions_for_columns(tokens, columns)
where_clauses = []
columns.each do |column|
column.search_sql.each do |search_sql|
where_clauses << "#{search_sql} #{column.text? ? ActiveScaffold::Finder.like_operator : '='} ?"
end
end
phrase = where_clauses.join(' OR ')
tokens.map do |columns_token|
columns.each_with_object([phrase]) do |column, condition|
condition.concat([columns_token[column.name]] * column.search_sql.size)
end
end
end
|