我有这个查询:
function sortArrayUnevenFirst (array) {
return array.sort(function(a,b){return b%2-a%2 || a-b});
}
console.log (sortArrayUnevenFirst([12,10,2,1,4,9,3,3]));
console.log (sortArrayUnevenFirst(['12','10','2','1','4','9','3','3']));
但是@imagecapturings_filter即使返回记录也没有用。
在日志中:
@imagecapturings_filter = Imagecapturing.where('kuerzel LIKE ? AND YEAR(datum_anfang) = ?', "%csg%",params[:select][:year]).page params[:page]
如果我在MySQL控制台中键入此SQL,则会得到:
Processing by ImagecapturingsController#index as HTML
Parameters: {"utf8"=>"✓", "select"=>{"year"=>"2018", "month"=>"all"}, "condition_field"=>"kuerzel", "predicate"=>"cont", "kuerzel"=>"csg", "submit"=>"filtern"}
(5.2ms) SELECT COUNT(*) FROM (SELECT 1 FROM `imagecapturing` WHERE (kuerzel LIKE '%csg%' AND YEAR(datum_anfang) = '2018') LIMIT 150 OFFSET 0) subquery_for_count
我该如何解决? (已编辑)