0
那時我有以下行零級搜索標籤
@noticias = Noticia.where(:tags.all => array).paginate(:page => params[:page])
它發生brakeman
說,它有可能的SQL注入的方法。 我嘗試以下代替:
array = params[:query].split(' ')
array.each_with_index do |query, index|
array[index] = array[index].gsub(/<\/?[^>]*>/, "").downcase
end
array.each do |tag|
@noticias << Noticia.where(:tags => tag)
end
,但我得到像`未定義,< <爲無:NilClass
我失去了什麼?
這就是我的想法,但錯誤呢?我的代碼有什麼問題? –