Fix N+1 query

parent 1067ec88
Pipeline #1099 failed with stages
in 0 seconds
......@@ -19,7 +19,7 @@ class AppliedJobsController < ApplicationController
def show
@count = current_user.job_applieds.count
return if @count.zero?
@applied_jobs = current_user.job_applieds.order("job_applieds.updated_at DESC").page(params[:page]).per(Job::LIMIT_PAGE)
@applied_jobs = current_user.job_applieds.includes(job: :cities).order("updated_at DESC").page(params[:page]).per(Job::LIMIT_PAGE)
return render_error_404 if @applied_jobs.blank?
end
......
......@@ -3,6 +3,6 @@ class HistoryJobsController < ApplicationController
def index
@count = current_user.histories.count
@history_jobs = current_user.histories.order_history
@history_jobs = current_user.histories.includes(job: :cities).order_history
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment