Eager-load jobs when querying job skills
This commit is contained in:
parent
dbe7c67b3d
commit
588d682801
1 changed files with 4 additions and 2 deletions
|
|
@ -4,11 +4,13 @@ module Api
|
|||
module V1
|
||||
class JobSkillsController < Api::V1::ApiController
|
||||
def all
|
||||
render json: JobSkillBlueprint.render(JobSkill.all)
|
||||
render json: JobSkillBlueprint.render(JobSkill.includes(:job).all)
|
||||
end
|
||||
|
||||
def job
|
||||
@skills = JobSkill.where('job_id != ? AND emp = ?', params[:id], true)
|
||||
@skills = JobSkill.includes(:job)
|
||||
.where.not(job_id: params[:id])
|
||||
.where(emp: true)
|
||||
render json: JobSkillBlueprint.render(@skills)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue