Commit b6201f91 by Thanh Hung Pham

Fix comment - move method to model

parent 5293c7ae
module CitiesHelper
def get_city_by_area(area)
City.where(area: area)
end
end
......@@ -2,4 +2,8 @@ class Area < ApplicationRecord
has_many :city
validates :name, presence: true
def self.get_city_by_area(area)
City.where(area: area)
end
end
......@@ -15,7 +15,7 @@
<div class="well">
<h3> <%= area.name %> </h3>
<div class="row">
<%- get_city_by_area(area).each do |city| -%>
<%- Area.get_city_by_area(area).each do |city| -%>
<%- if city.job.count > 0 -%>
<div class="col-md-4">
<%= link_to city.name, jobs_show_path(city_id: city.id) %>
......
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