选用实践课程的搜索

dev_forum
cxt 6 years ago
parent a7833fa720
commit 486ae178a3

@ -69,7 +69,8 @@ class SubjectsController < ApplicationController
else
@subjects = @subjects[offset, limit]
subject_ids = @subjects.pluck(:id)
@subjects = Subject.where(id: subject_ids).order("field(id,#{subject_ids.join(',')})").includes(:shixuns, :repertoire)
order_ids = subject_ids.size > 0 ? subject_ids.join(',') : -1
@subjects = Subject.where(id: subject_ids).order("field(id,#{order_ids})").includes(:shixuns, :repertoire)
end
end

Loading…
Cancel
Save