Commit 0173688a by Thanh Hung Pham

Fix comment - Don't query DB in view

parent 58da1976
......@@ -49,6 +49,7 @@ class JobsController < ApplicationController
end
def index
@favorite = Favorite.where(user: current_user, job: job)
end
def favorite
......
......@@ -34,7 +34,7 @@
<td> <%= job.city.try(:name) %> </td>
<td> <%= job.salary %> </td>
<td>
<% if Favorite.where(user: current_user, job: job).blank? %>
<% if @favorite.blank? %>
<div class="col-md-3" id="favorite_<%= job.id %>">
<%= link_to 'Favorite', jobs_favorite_path(job_id: job.id, format: 'js'), remote: true, class: 'favorite_add' %>
</div>
......
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