Commit b0557443 by nnnghia98

define method for job count

parent fb446316
...@@ -19,4 +19,8 @@ class City < ApplicationRecord ...@@ -19,4 +19,8 @@ class City < ApplicationRecord
scope :vn_cities, -> {where region: "Việt Nam"} scope :vn_cities, -> {where region: "Việt Nam"}
scope :inter_cities, -> {where region: "#"} scope :inter_cities, -> {where region: "#"}
def job_count
jobs.count
end
end end
<div class="col-md-3"> <div class="col-md-3">
<div class="col-show"> <div class="col-show">
<%= city.name %> (<%= (city.jobs.count) %>) <%= city.name %> (<%= (city.job_count) %>)
</div> </div>
</div> </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