Commit f5e77b66 by Tô Ngọc Ánh

histories list

parent edb1419c
Pipeline #988 failed with stages
in 0 seconds
...@@ -2,7 +2,7 @@ class FavoritesController < ApplicationController ...@@ -2,7 +2,7 @@ class FavoritesController < ApplicationController
before_action :authenticate_user! before_action :authenticate_user!
def index def index
favorites = current_user.favorites.select(:job_id).all favorites = current_user.favorites.pluck(:job_id)
@jobs = Job.where(id: favorites).includes(:company, :locations).page(params[:page]) @jobs = Job.where(id: favorites).includes(:company, :locations).page(params[:page])
end end
......
...@@ -2,7 +2,7 @@ class HistoriesController < ApplicationController ...@@ -2,7 +2,7 @@ class HistoriesController < ApplicationController
before_action :authenticate_user! before_action :authenticate_user!
def index def index
histories = current_user.histories.select(:job_id).all histories = current_user.histories.order(created_at: :asc).take(20).pluck(:job_id)
@jobs = Job.where(id: histories).includes(:company, :locations).limit(20) @jobs = Job.where(id: histories).includes(:company, :locations)
end end
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